CustomTkinter/test/manual_integration_tests/test_combobox.py

31 lines
514 B
Python
Raw Normal View History

from tkinter import *
ws = Tk()
ws.title('PythonGuides')
ws.geometry('400x300')
ws.config(bg='#F2B90C')
def display_selected(choice):
choice = variable.get()
print(choice)
countries = ['Bahamas','Canada', 'Cuba','United States']
# setting variable for Integers
variable = StringVar()
variable.set(countries[3])
# creating widget
dropdown = OptionMenu(
ws,
variable,
*countries,
command=display_selected
)
# positioning widget
dropdown.pack(expand=True)
# infinite loop
ws.mainloop()