如何设置某些Tkinter小部件的边框颜色? [英] How to set border color of certain Tkinter widgets?
本文介绍了如何设置某些Tkinter小部件的边框颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图改变我的Tkinter应用程序的背景颜色,但对于某些小部件,它在边缘周围留下一个白色边框。
I'm trying to change the background color of my Tkinter app, but for certain widgets it leaves a white border around the edges.
例如:
from tkinter import *
COLOR = "black"
root = Tk()
root.config(bg=COLOR)
button = Button(text="button", bg=COLOR)
button.pack(padx=5, pady=5)
entry = Entry(bg=COLOR, fg='white')
entry.pack(padx=5, pady=5)
text = Text(bg=COLOR, fg='white')
text.pack(padx=5, pady=5)
root.mainloop()
如何设置某些Tkinter小部件的边框颜色?
How can I set border colour of certain Tkinter widgets?
推荐答案
只需使用 widget.config(highlightbackground = COLOR)
这篇关于如何设置某些Tkinter小部件的边框颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文