我的背景色有问题 这是我为此框架编写的代码
class MainPage(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent) #initializing parent class
self.controller = controller
#Labels to be displayed
label = tk.Label(self, text="Welcome to the Grade Calculator", anchor="center", bg="lavender",
font = controller.title_font)
label1 = tk.Label(self, text="Please enter your name to start:",
font="times 30", bg="lavender")
#entry
self.entry = Entry(self,bg = "yellow")
button1 = tk.Button(self, text="Save and Continue",
command= lambda: self.cmmd(), height =3,
bg="green")
#gridding
label.grid(row=3, column=0, rowspan=2, columnspan=10, sticky="EW")
label1.grid(row=14, rowspan=3, column=0, sticky=E)
self.entry.grid(row=14,rowspan=3,column=1, sticky="E")
button1.grid(row = 19,column=1, sticky=W+E)
#this function saves the typed name into student_name and displays the menupage frame
def cmmd(self):
self.controller.student_name = self.entry.get()
print(self.controller.student_name)
create(self.controller.student_name)
self.controller.show_frame(MenuPage)
picture here 有人可以帮我吗?
完整代码here
答案 0 :(得分:0)
我知道,我不是唯一失败的人。 ^^
您还必须将Frame的背景设置为'lavende'
,因为它没有完全被其他小部件填充,因此其中的一些可以正常显示。所以只需更改:
Frame.__init__(self, parent)
收件人:
Frame.__init__(self, parent, bg='lavende')