[Tkinter-discuss] OptionMenu, change the list of choices
mkieverpy at tlink.de
mkieverpy at tlink.de
Tue Oct 24 15:51:37 CEST 2006
Vasilis Vlachoudis wrote:
>
> values=["One","Two","Three"] # Initial list
> o = OptionMenu(frame, *values)
> #...
> #then later in the code read new values from a file
> newvalues = f.readline().split()
> o.config(???=newvalues)
>
With
m = o.children ['menu']
you can access the menu which implements the OptionMenu.
OptionMenu uses 'command' entries.
So you can add new entries with
m.add_command(label='a_new_entry',command=if_you_need_to_set_a_var_or_something)
I never used this personally.
Hope it works for you.
Matthias Kievernagel
mkiever at web dot de
More information about the Tkinter-discuss
mailing list