Tkinter menu toplevel or frame
Gigs_
gigs at hi.t-com.hr
Fri Mar 16 14:22:20 EDT 2007
what is the best way to write tkinter menus? As toplevels or as frame
with Menubutton?
im doing like this
class MyWidget(Frame):
def __init__(self, master=None): """ should this master be
parent? Because my first tought was that this is toplevel master than i
found that its not"""
Frame.__init__(self, master) # and this too than
self.config(width=200, height=200)
self.pack(fill=BOTH, expand=YES)
self.makeMenuBar()
def makeMenuBar(self):
self.menubar = Menu(self.master)
self.master.config(menu=self.menubar)
pulldown = Menu(self.menubar, tearoff=0)
pulldown.add_command(label='New', command=self.new)
pulldown.add_command(label='Open', command=self.onOpen)
pulldown.add_command(label='Save', command=self.save)
pulldown.add_command(label='Save As', command=self.saveas)
pulldown.add_separator()
pulldown.add_command(label='Exit', command=self.onExit)
self.menubar.add_cascade(label='File', underline=0, menu=pulldown)
Please tell me is here anything that I should change.
More information about the Python-list
mailing list