Tkinter menus

Eric Brunel eric_brunel at despammed.com
Fri Mar 2 17:27:30 CET 2007


On Fri, 02 Mar 2007 13:41:12 +0100, Gigs_ <gigs at hi.t-com.hr> wrote:
> is it alright to use Menu instead Toplevel or Tk
> like this?
>
> from Tkinter import *
> from tkMessageBox import *
>
> class MenuDemo(Menu):
>      def __init__(self, master=None):
>          Menu.__init__(self, master)
>          self.createWidgets()
>          self.master.title('Toolbars and Mennus')
>          self.master.iconname('tkpython')
>
>      def createWidgets(self):
>          self.makeMenuBar()
>          self.makeToolBar()
>          L = Label(self.master, text='Menu and Toolbar demo')
>          L.config(relief=SUNKEN, width=40, height=10, bg='white')
>          L.pack(expand=YES, fill=BOTH)

Feels weird to me. Creating widgets in a window from what is supposed to  
its its menu is quite unexpected. I would definitely create a sub-class of  
Toplevel or Tk and create the menu in it.

HTH
-- 
python -c "print ''.join([chr(154 - ord(c)) for c in  
'U(17zX(%,5.zmz5(17l8(%,5.Z*(93-965$l7+-'])"



More information about the Python-list mailing list