so i am confused on how to add menu options to my windows... i clearly can make a menubar and know how to do that as you can see in my code. however, the way i have the windows change from one to another is affecting things because i have only 1 Tk.tk window. the rest of the program operates inside that window. I would like to be able to change the title and the menu for each window.
class start(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 = {}
tk.Tk.title(self, "Group Registration")
menubar = tk.Menu(container)
tk.Tk.config(self, menu=menubar)
fileMenu = tk.Menu(menubar, tearoff=0)
menubar.add_cascade(label="File", menu=fileMenu)
fileMenu.add_command(label="Exit", command=quit)
for F in (begin, admin_main, members):
frame = F(container, self)
self.frames[F] = frame
frame.grid(row=0, column=0, sticky="nsew")
self.show_frame(begin)
def show_frame(self, cont):
frame = self.frames[cont]
frame.tkraise()
frame.event_generate("<<showframe>>")
class begin(tk.Frame):
pass
class admin_main(tk.Frame):
def __init__(self, parent, controller):
self.bind("<<showframe>>", self.on_show_frame)
def on_show_frame(self, event):
menubar = Menu(self)
fileMenu = Menu(menubar)
menubar.add_cascade(label="File", menu=fileMenu)
fileMenu.add_command(label="Create member list")#command=)
fileMenu.add_command(label="Load member list")#command=)
fileMenu.add_command(label="Email")#command=)
fileMenu.add_separator()
fileMenu.add_command(label="Exit")
print"ok"
class members(tk.Frame):
pass
app = start()
app.geometry("600x400")
app.mainloop()
the classes are my new windows. this is just short version of code to show how windows operate...
(REVISED) interpreter will print "ok" when page opens. there is no syntax with it revised again... however, i do not have my new menubar showing up.