using the Python 2.7 Tkinter Grid Layouter, i would like to do something like
root.button = Button(root, bg = 'green', ....)
root.button.grid(...)
in order to get a green button. Running this, it doesn't bring up any errors, but the button does not take the desired color. Any suggestions greatly appreciated!
EDIT: thanks for the code, i copied it and run it, here is what i get: still a white button ..?
Passing bg
keyword argument works as expected. Try following:
from Tkinter import *
root = Tk()
button = Button(root, text='buggton', bg='green')
button.grid(row=0, column=0)
root.mainloop()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.