I'm trying to get the optionmenu to work on my current project file but i keep getting the error TypeError: init() takes from 2 to 3 positional arguments but 9 were given so i wanted to see if it was the code, and i made a new project file and pasted it in there with a previous revision of the project that i currently have and it worked perfectly fine. Any ideas as to why i get the error on my current project file? heres the code
def Pantsize():
# Drop box for pant size
# Figure out how to label for pant sizes
PantsClick = StringVar()
PantsClick.set("Select pant size")
PantsDrop = OptionMenu(AppWindow, PantsClick, "Select pant size", "XS", "S", "M", "L", "XL")
PantsDrop.place(relx=0.3, rely=0.25)
Based on what I've read from this site.
tkinter.OptionMenu takes 2 or 3 parameters.
Therefore, your third parameter
"Select pant size"
is now unnecessary since that is already your second parameterPantsClick
because on line 5PantsClick.set("Select pant size")
.If the answer above still doesn't work. Try to add a new variable
size_options
then place all of the choices inside a tuple. Then use*
on that tuple when passing it as an argument.