我试图将此页面分开。任何人都可以帮助我理解如何将PageOne划分为帧。我想在按钮的导航栏部分和输入表格的另一部分
class rhizoApp(tk.Tk):
def __init__(self, *args, **kwargs):
tk.Tk.__init__(self, *args, **kwargs)
#tk.Tk.wm_iconbitmap(self, default="rhizo.ico")
tk.Tk.wm_title(self, "Rhizo Control Center")
container = tk.Frame(self)
container.pack(side="top", fill="both", expand = True)
container.grid_rowconfigure(0, weight=1)
container.grid_columnconfigure(0, weight=1)
self.frames = {}
for F in (StartPage, PageOne, PageTwo):
frame = F(container, self)
self.frames[F] = frame
frame.grid(row=0, column=0, sticky="nsew")
self.show_frame(StartPage)
def show_frame(self, cont):
frame = self.frames[cont]
frame.tkraise()
class StartPage(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
label = tk.Label(self, text="Home Page", font=LARGE_FONT, bd=2, bg='red', width=50, height=5)
label.grid(row=0, column=0, pady=10, padx=10, sticky='N', columnspan=10)
button1 = tk.Button(self, text="Testing", relief='raised', command=lambda: controller.show_frame(PageOne))
button1.grid(row=2, column=0, sticky='w', padx=10, pady=10)
button2 = tk.Button(self, text="Analysis", command=lambda: controller.show_frame(PageTwo))
button2.grid(row=2, column=9, sticky='se', padx=10, pady=10)
我只是因为我试着做了一点迷失
frame1=tk.Frame(parent)
也:
frame1=tk.Frame(self)
但是python只是挂起。