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

Bryan Oakley bryan.oakley at gmail.com
Wed May 14 18:25:10 CEST 2014


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/20140514/26e55bb0/attachment.html>


More information about the Tkinter-discuss mailing list