简体   繁体   English

如何为 Tkinter window 添加背景颜色?

[英]How to add a background color to a Tkinter window?

I am a beginner here.我是这里的初学者。 I want to know how to add a background color to a Tkinter main window apart from root.config(bg='black') .我想知道如何将背景颜色添加到 Tkinter main window 除了root.config(bg='black')

You can use:您可以使用:

root['bg'] = 'color you want'

It works perfectly well.它工作得很好。 But I think the config method will be a better opinion.但我认为 config 方法会是一个更好的意见。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用Tkinter按钮更新窗口的背景颜色 - How can I update a window's background color with a Tkinter Button 如何更改 window (Python) (Tkinter) 特定部分的背景颜色 - How to change background color for a specific portion of window (Python) (Tkinter) 在Python 2.7中更改Tkinter窗口的背景颜色 - Change background color of Tkinter window in Python 2.7 窗口未完全填充特定背景颜色 - tkinter - Window not fully filled with specific background color - tkinter Tkinter Window 背景颜色在 MacOS 上不起作用 - Tkinter Window Background Color Not Working On MacOS 如何在顶级窗口的tkinter上添加图片背景? - How do I add a picture background on tkinter on a toplevel window? 在python 3和tkinter中使用colorchooser改变tkinter窗口背景的颜色 - Changing color of background of tkinter window by using colorchooser in python 3 and tkinter 如何在 tkinter python 的框架中添加背景图像? 我想要一个图像而不是背景颜色 - How to add background image to the frame in tkinter python? Instead of background color I want an image 我如何定义一个变量来标识窗口的背景色(python,tkinter) - How do I define a variable that identifies the background color of the window (python, tkinter) 如何使用tkinter将滚动条添加到窗口? - How to add a scrollbar to a window with tkinter?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM