Skip to content

Commit eddb217

Browse files
feat Python Tkinter Dependent Drop Downs and List Boxes complete
Python Tkinter Dependent Drop Downs and List Boxes complete resolvesr: # se also: #
1 parent 99dd1b6 commit eddb217

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Python Tkinter Dependent Drop Downs and List Boxes/DependentDropDownsandList Boxes.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,26 @@ def pick_color(e):
7070
my_list1.grid(row=0, column=0)
7171
my_list2.grid(row=0, column=1, padx=20)
7272

73+
def list_color(e):
74+
my_list2.delete(0, END)
7375

76+
if my_list1.get(ANCHOR) == "Small":
77+
for item in small_colors:
78+
my_list2.insert(END, item)
79+
80+
if my_list1.get(ANCHOR) == "Medium":
81+
for item in medium_colors:
82+
my_list2.insert(END, item)
83+
84+
if my_list1.get(ANCHOR) == "Large":
85+
for item in large_colors:
86+
my_list2.insert(END, item)
87+
88+
#add items to list1
89+
for item in sizes:
90+
my_list1.insert(END, item)
91+
92+
# Bind the Listbox
93+
my_list1.bind("<<ListboxSelect>>", list_color)
7494

7595
root.mainloop()

0 commit comments

Comments
 (0)