On Thu, 2006-04-06 at 12:27 -0700, ishtar2020 wrote: > Hi everybody > > I'd appreciate some help on creating a tear off menu with TkInter. I've > been reading some documentation but still no luck. > > Please don't get confused: when I mean "tear off" menu I don't mean a > drop-down or a pop-up menu, but those options which yield to another > batch of sub-options when scrolled over, (as for example, the File->New > option from internet explorer). > > I'm sure TkInter supports those widgets because the IDLE editor is > built on it and it's got some tear off options like File->Recent Files. > > Thank you all in advance >
Are you sure you don't mean a cascading menu ? A tearoff menu gives the user the ability to tear off the menu into a new top level window. The following example illustrates the difference: from Tkinter import * r = Tk() m = Menu(r) # Create a cascading Edit menu editmenu = Menu(m, tearoff=0) editmenu.add_command(label='copy') editmenu.add_command(label='cut') editmenu.add_command(label='paste') # Create a sub menu of the edit menu and use tearoff option testmenu = Menu(editmenu, tearoff=1) testmenu.add_command(label='option1') testmenu.add_command(label='option2') # add the sub menu to the editmenu editmenu.add_cascade(label='test', menu=testmenu) # Add the edit menu to the menu bar m.add_cascade(label='Edit', menu=editmenu) # Display the menu r.config(menu=m) r.mainloop() John McMonagle -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- http://mail.python.org/mailman/listinfo/python-list