Thanks!!
#################################################################
from Tkinter import *
class _helper:
def __init__(self, var, value):
self.__value = value
self.__var = var
def __call__(self, *args):
self.__var.set(self.__value)
root = Tk()
def theEnd():
header.set('Exiting')
File.__getitem__('menu').delete('Jorge')
print File.__getitem__('text')
root.after(2000, root.destroy)
frame = Frame(root)
header = StringVar()
header.set('flaut')
File = OptionMenu(frame, header,'An option', 'Another')
File.__getitem__('menu').add_command(label='Jorge',
command=_helper(header, 'Jorge'))
File.pack()
File.__getitem__('menu').configure(background='white')
Button(frame, text='quit', command=theEnd).pack()
frame.pack()
root.mainloop()
I've attached two samples. And make sure to check the newsgroup
archives as well: http://www.python.org/search
Thanks, Fredrik!
The second example was especially helpful since I want my OptionMenu
to be created from a list.
Tracy