[Tkinter-discuss] How to enable/disable a menu?

Alejandro Autalan alejandroautalan at gmail.com
Wed May 14 03:21:39 CEST 2014


2014-05-13 15:51 GMT-03:00 Alan Gauld <alan.gauld at btinternet.com>:
> I have an app with a tabbed notebook. I want to
> only enable one of the main menus when the appropriate
> tab is selected. When the tab is deselected I want
> to disable the menu again.
>
> I can't see any obvious properties in the Menu
> object. I can mess around with flags in the event
> handlers and change the menu font colours etc but
> that's pretty horrible. Is there anything better?
>
> Using Python 3.3; on Linux and Windows 8 if it makes
> any difference.
>
> TIA
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> http://www.flickr.com/photos/alangauldphotos
>
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss at python.org
> https://mail.python.org/mailman/listinfo/tkinter-discuss

Hello,
You can use the 'state' option of the menuitem.
Here's an example: http://linkode.org/tE01VF7sGPOXjvsWymBqi4

Regards
Alejandro A.


More information about the Tkinter-discuss mailing list