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.
使用 Python 2.7 Tkinter Grid Layouter,我想做类似的事情
root.button = Button(root, bg = 'green', ....) root.button.grid(...)
为了得到一个绿色按钮。运行它,它不会出现任何错误,但按钮不会采用所需的颜色。任何建议都非常感谢!
编辑:感谢代码,我复制并运行它,这是我得到的:仍然是一个白色按钮..?
传递bg关键字参数按预期工作。尝试以下操作:
bg
from Tkinter import * root = Tk() button = Button(root, text='buggton', bg='green') button.grid(row=0, column=0) root.mainloop()