Reputation: 63
I have the following code :
from Tkinter import *
import Tkinter as ttk
from ttk import *
win=Tk()
OPTIONS=["PIM","RR"]
var = StringVar()
option = OptionMenu(win, var, *OPTIONS )
option.pack()
win.mainloop()
The code creates a window witha single drop down list with RR and PIM with PIM set by default. The problem is that when RR is selected PIM disappears from the list.
Upvotes: 0
Views: 920
Reputation: 368944
The third parameter is default
value that is selected. And the fourth parameter is values. So it should be specified as follow:
option = OptionMenu(win, var, OPTIONS[0], *OPTIONS)
FYI, here's the signature of the OptionMenu.__init__
method:
__init__(self, master, variable, default=None, *values, **kwargs)
Upvotes: 2