I added a OptionMenu
widget to my code, and assigned a list as it's options. This is how it is:
z = StringVar()
z.set(userList[0])
usersOption = OptionMenu(frame1, z, *userList)#, command=changeUser)
usersOption.pack(side=RIGHT, padx=3)
Now, I reckon it would show all the options in said list. As so:
Option 1 \/ <-- the box with the selected option
Option 1 }\__the options that show on click
Option 2 }/
but it actually only shows the second option, and when I choose it there is, basically, no way back, if I click the box again it keeps only showing option 2 and I can't change it even with the up and down keys. I tried looking for solutions, but I got nowhere, so I'm starting to think it is the default operating way of the widget, but I found nothing to show me how to solve it in the documentation I read.
P.S.: I'm using Python 3.3
I had the same problem and it was driving me mad, so i looked in the source. I think the issue is that the 3rd constructor argument is the default value. If you don't specify it before *userList, it looks like it takes the first item as the default value. A real fix would be something like:
z = StringVar()
z.set(userList[0])
usersOption = OptionMenu(frame1, z, userList[0] ,*userList)#, command=changeUser)
usersOption.pack(side=RIGHT, padx=3)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With