python - OptionMenu won't show the first option when clicked (Tkinter) -


i added optionmenu widget code, , assigned list it's options. how is:

z = stringvar()    z.set(userlist[0])     usersoption = optionmenu(frame1, z, *userlist)#, command=changeuser) usersoption.pack(side=right, padx=3) 

now, reckon show options in said list. so:

option 1 \/ <-- box selected option option 1 }\__the options show on click option 2 }/ 

but shows second option, , when choose there is, basically, no way back, if click box again keeps showing option 2 , can't change , down keys. tried looking solutions, got nowhere, i'm starting think default operating way of widget, found nothing show me how solve in documentation read.
p.s.: i'm using python 3.3

i had same problem , driving me mad, looked in source. think issue 3rd constructor argument default value. if don't specify before *userlist, looks takes first item default value. real fix like:

z = stringvar()    z.set(userlist[0])     usersoption = optionmenu(frame1, z, userlist[0] ,*userlist)#, command=changeuser) usersoption.pack(side=right, padx=3) 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -