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

ALAN GAULD alan.gauld at btinternet.com
Thu May 15 01:01:53 CEST 2014


Thanks Bryan, 
I played around with that and its exactly what I needed.

Thanks to all who sent comments.
 
Alan Gauld
Author of the Learn To Program website
http://www.alan-g.me.uk/

http://www.flickr.com/photos/alangauldphotos



>________________________________
> From: Bryan Oakley <bryan.oakley at gmail.com>
>To: ALAN GAULD <alan.gauld at btinternet.com> 
>Cc: "tkinter-discuss at python.org" <tkinter-discuss at python.org> 
>Sent: Wednesday, 14 May 2014, 17:25
>Subject: Re: [Tkinter-discuss] How to enable/disable a menu?
> 
>
>
>The "state" attribute.
>
>
>Here's a working example:
>
>
>import Tkinter as tk
>
>
>root = tk.Tk()
>menubar = tk.Menu(root)
>root.configure(menu=menubar)
>
>
>exampleMenu = tk.Menu(root)
>exampleMenu.add_command(label="One")
>exampleMenu.add_command(label="Two")
>exampleMenu.add_command(label="Three")
>menubar.add_cascade(label="Example", menu=exampleMenu)
>
>
>menubar.entryconfigure("Example", state="disabled")
>
>
>root.mainloop()
>
>
>
>
>
>On Wed, May 14, 2014 at 10:59 AM, ALAN GAULD <alan.gauld at btinternet.com> wrote:
>
>
>>
>>
>>>You can disable the button or menu item the menu is associated with, and that will disable the whole menu. Thats what I assumed but which proprerty disables a menu - or any other widget for that matter? 
>>I'm assuming its an inherited atttribute of some sort?
>>
>>
>>
>>Alan G
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20140515/7021abaf/attachment-0001.html>


More information about the Tkinter-discuss mailing list