Is there a way to make an options menu perform a command from a range of different commands?
from tkinter import *
#creates 2 windows
root = Tk()
popup = Toplevel()
#places frame in popup window
popup_frame = Frame(popup)
popup_frame.pack()
#4 functions, text is just placeholder for idea
def popup1(popup):
popup_frame.destroy()
popup_frame = Frame(popup)
label_popup1 = Label(popup_frame, text="unique textfor popup1")
popup_frame.pack()
label_popup1.pack()
def popup2(popup):
popup_frame.destroy()
popup_frame = Frame(popup)
label_popup2 = Label(popup_frame, text="unique text for popup2")
popup_frame.pack()
label_popup2.pack()
def popup3(popup):
popup_frame.destroy()
popup_frame = Frame(popup)
label_popup3 = Label(popup_frame, text="unique text for popup3")
popup_frame.pack()
label_popup3.pack()
def popup1(popup):
popup_frame.destroy()
popup_frame = Frame(popup)
label_popup4 = Label(popup_frame, text="unique text for popup4")
popup_frame.pack()
label_popup4.pack()
#2 option menus offering different selections
options1 = ["popup1", "popup2"]
variable1 = StringVar()
drop_title1 = StringVar(root)
#sets initial name for widget
drop_title1.set("Please Choose Options 1 Or 2")
dropdownmenu1 = OptionMenu(root, drop_title1, *options, command=lambda:func())
dropdownmenu1.place(x=10, y=10)
options2 = ["popup3", "popup4"]
variable2 = StringVar()
drop_title2 = StringVar(root)
drop_title2 .set("Please Choose Options 3 Or 4")
dropdownmenu2 = OptionMenu(root, drop_title2, *options, command=lambda:func())
dropdownmenu2.place(x=100, y=10)
root.mainloop()
So there is the root frame with 2 different dropdown menus in it, where if you clicked on say option 1, the popup_frame would be deleted and replaced with the contents of option 1, then from the second drop-down menu, option 4 is selected and the contents of the popup_frame change to what option 4 contains?