Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我写了一个代码来在我的屏幕上弹出一个窗口并在窗口上打印一个数据。根据我的要求,我希望整个屏幕都是黑色的。这样我就可以在那个黑色窗口上打印一些文本。应删除窗口标题栏 tkinter,并且整个窗口屏幕应为黑色。
尝试self.configure(background='black')或self['bg'] = 'black'。大多数 Tkinter 小部件可以配置有类似的属性。
self.configure(background='black')
self['bg'] = 'black'
做就是了:
from tkinter import * root = Tk() root.title('') root.config(background='black') root.mainloop()
那应该行得通!