In this context:

from Tkinter import *

Root = Tk()

def about():
    # Whatever
    return

def progQuitter():
    # Whatever
    return

def makeMenu(Win):
    global Fi   # or most likely a dictionary that achieves the same thing
    global Hp
    global Top
    Top = Menu(Win)
    Win.configure(menu = Top)
    Fi = Menu(Top, tearoff = 0)
    Top.add_cascade(label = "File", menu = Fi)
    Fi.add_command(label = "Quit", command = progQuitter)
    Hp = Menu(Top, tearoff = 0)
    Top.add_cascade(label = "Help", menu = Hp)
    Hp.add_command(label = "About", command = about)
    return

makeMenu(Root)
Root.mainloop()

I want to write a function like

    def disableMenu("File", "Quit")
        # Finds the Quit item in File cascade and sets its state to DISABLED
        return

How would disableMenu() entrycget() through the menu items to find the index 
of the "Quit" item?  How do I get a list of the cascades ("File", "Help" - 
just looping through Top.entrycget(i, "label") seems to do that) and then a 
list of the items in those cascades ("Quit", "About")?

As an aside

    print Fi.entrycget(1, "label")

seems to work, but (2, "label") doesn't.  It says "-label" is an unknown 
option.  I guess I don't know what I'm doing. :)

Thanks!

Bob

_______________________________________________
Tkinter-discuss mailing list
[email protected]
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to