Just like the famous example of having Continent names in one dropdown and display country names related to selected Continent. How to achieve this using Tkinter? I have Continent list in first dropdown and list of all countries related to continents in the list. I would like to display country_11,country_12 when continent_1 is selected, similarly for other continents.
Here is the piece of code am working on -
import tkinter as tk
from tkinter import ttk
from tkinter import *
root = tk.Tk()
root.geometry('500x500')
#Label to Continent
label_1 = tk.Label(root, text="Select the Continent", font = (8), bg = '#ffe1c4')
label_1.place(x = 120, y = 220)
# Continent selection - drop down
optionList1 = ["Continent1", "Continent2","Continent3"]
dropVar1 = StringVar()
dropMenu1 = ttk.OptionMenu(root, dropVar1 , *optionList1)
dropMenu1.place(x = 300, y = 220)
#Label to Select Country
label_2 = tk.Label(root, text="Select the Country ", font = (8), bg = '#ffe1c4')
label_2.place(x = 120, y = 250)
# Country name selection - drop down
optionList2 = ["Country_11", "Country_12", "Country_21","Country_22","Country_31","Country_32"]
dropVar2 = StringVar()
dropMenu2 = ttk.OptionMenu(root, dropVar2, *optionList2)
dropMenu2.place(x = 300, y = 250)
root.mainloop()
Would be great to have a solution to this as am not aware of all the attributes OptionMenu can have in Tkinter. Thanks in advance!!