Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter as tk
- SMALL_FONT= ("Verdana", 10)
- MEDIUM_FONT= ("Verdana",12)
- LARGE_FONT= ("Verdana", 16)
- class SeaofBTCapp(tk.Tk):
- def __init__(self, *args, **kwargs):
- tk.Tk.__init__(self, *args, **kwargs)
- 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 = {}
- frame = StartPage(container, self)
- self.frames[StartPage] = 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="Start Page", font=LARGE_FONT)
- label.pack(pady=10,padx=10)
- button1 = tk.Button(self, text="Visit Page 1",
- command=lambda: controller.show_frame(PageOne))
- button1.pack()
- class PageOne(tk.Frame):
- def __init__(self, parent, controller):
- tk.Frame.__init__(self,parent)
- label = tk.Label(self, text="PageOne", font=LARGE_FONT)
- label.pack(pady=10,padx=10)
- app = SeaofBTCapp()
- app.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement