[Tutor] Disable menubar
Alberto Troiano
albertito_g at hotmail.com
Fri May 20 00:47:59 CEST 2005
YES!!!!
That's what I was looking for and I will replace it.
I don't like to much the MenuBar from Pmw its different and it does not have
all the menu attributes that windows menu have (or maybe I don't know how to
use it well :D)
About disabling the button it would be nice to know if that can be done ,
although I made some work around and I managed to restrict the Toplevels.
If anybody wants to know how I can post the code
Thanks in advanced
Alberto
>From: jfouhy at paradise.net.nz
>To: Alberto Troiano <albertito_g at hotmail.com>
>Subject: Re: [Tutor] Disable menubar
>Date: Fri, 20 May 2005 10:15:49 +1200 (NZST)
>
>Quoting Alberto Troiano <albertito_g at hotmail.com>:
>
> > The reason is that I couldn't find an example to make a menu with
> > cascade submenus and another cascade submenu inside the submenu and so
>on.
> > Now I want to ask if somebody knows how to accomplish these with Menu
> > from TKinter?
>
>Here is some code:
>
> >>> from Tkinter import *
> >>> tk = Tk()
> >>> m = Menu(tk)
> >>> m2 = Menu(m, tearoff=False)
> >>> m.add_cascade(label='foo', menu=m2)
> >>> m3 = Menu(m2, tearoff=False)
> >>> m2.add_cascade(label='bar', menu=m3)
> >>> m3.add_command(label='One')
> >>> m3.add_command(label='Two')
> >>> tk.config(menu=m)
>
>Is this what you are after? Check the attachment for what it produces.
>
>You could add more menus, eg:
>
> >>> m4 = Menu(m3, tearoff=False)
> >>> m3.add_cascade(label='baz', menu=m4)
> >>> m4.add_command(label='Three')
> >>> m4.add_command(label='Four')
>
>I think using Tkinter.Menu is better than Pmw, because Tkinter.Menu will
>use
>native menu widgets (which means your menu will look the same as other
>menus in
>other apps), whereas I think Pmw may do its own thing.
>
>--
>John.
><< menu.jpg >>
Gaucho
More information about the Tutor
mailing list