我有一个Tkinter应用程序,但我想把第一列的背景颜色改为蓝色
from tkinter import *
from tkinter import ttk
root = Tk()
mainframe = ttk.Frame(root, padding="3 3 500 200")
mainframe.grid(column=0, row=0)
ttk.Label(mainframe, text="COLUMN 1 ROW 1").grid(column=1, row=1)
root.mainloop()
我尝试了以下操作,但收到一个错误:
^{pr2}$
在tkinter.tc错误公司名称:Traceback (most recent call last):
File "/Users/chriscruz/Desktop/aesop_1.1.py", line 11, in
ttk.Label(mainframe, text="COLUMN 1 ROW 1").grid(column=1, row=1,bg ="blue4")
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 2029, in grid_configure
+ self._options(cnf, kw))
_tkinter.TclError: bad option "-bg": must be -column, -columnspan, -in, -ipadx, -ipady, -padx, -pady, -row, -rowspan, or -sticky