class RehabArm(tk.Tk):
def __init__(self, *args, **kwargs):
tk.Tk.__init__(self, *args, **kwargs)
tk.Tk.iconbitmap(self, default="nurse.ico")
tk.Tk.wm_title(self, "Rehabilitation Arm")
container = tk.Frame(self)
container.pack(side="top", fill="both", expand=True)
container.grid_rowconfigure(0, weight=1)
container.grid_columnconfigure(0, weight=1)
menubar = tk.Menu(container)
filemenu = tk.Menu(menubar, tearoff=0)
filemenu.add_command(label="Save Settings",
command = lambda: popupmsg("Not supported just yet"))
filemenu.add_separator()
filemenu.add_command(label="Exit", command=quit)
menubar.add_cascade(label="File", menu=filemenu)
#logo=tk.Icon(filemenu, file="home.ico")
helpmenu = tk.Menu(menubar, tearoff=0)
helpmenu.add_command(label="Tutorial", command=tutorial)
menubar.add_cascade(label="Help", menu=helpmenu)
tk.Tk.config(self, menu=menubar)
self.frames = {}
#add each page here
for F in (WelcomePage, StartPage, ExitPage, DetailsPage, ExercisePage,
ActivePage, PassivePage, CommentPage, SavePage, PageThree):
frame = F(container, self)
self.frames[F] = frame
frame.grid(row=0, column=0, sticky="nsew") #sticky north south east west
self.show_frame(WelcomePage)
def show_frame(self, cont):
frame = self.frames[cont]
frame.tkraise()
class WelcomePage(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self,parent)
label = tk.Label(self, text="Welcome to Physiotherabot", font= SUPERLARGE_FONT)
label.pack(pady=10, padx=10)
button1 = ttk.Button(self, text="Start",
command=lambda: controller.show_frame(StartPage))
#when using button1.grid,, it not giving any error,,,but keep loading
button1.grid(row=1, column=1) #side=tk.TOP, fill=tk.BOTH, expand=True
button2 = ttk.Button(self, text="Exit",
command=lambda: controller.show_frame(ExitPage))
button2.pack() #side=tk.TOP, fill=tk.BOTH, expand=True
If using button1.pack
, it can run smoothly, I try to configure row and column, but cannot find the suitable place because it keep loading when I run it.