CustomTkinter/test/manual_integration_tests/test_optionmenu.py

26 lines
618 B
Python
Raw Normal View History

2022-05-30 18:20:27 +03:00
import tkinter
import customtkinter
2022-05-30 18:20:27 +03:00
app = customtkinter.CTk()
app.title('test_optionmenu.py')
app.geometry('400x300')
2022-05-30 18:20:27 +03:00
def select_callback(choice):
choice = variable.get()
2022-05-30 17:46:36 +03:00
print("display_selected", choice)
2022-05-30 18:20:27 +03:00
countries = ['Bahamas', 'Canada', 'Cuba', 'United States']
variable = tkinter.StringVar()
variable.set("test")
2022-05-30 18:20:27 +03:00
optionmenu_tk = tkinter.OptionMenu(app, variable, *countries, command=select_callback)
2022-05-30 16:48:41 +03:00
optionmenu_tk.pack(pady=10, padx=10)
2022-05-30 18:20:27 +03:00
optionmenu_1 = customtkinter.CTkOptionMenu(app, variable=variable, values=countries, command=select_callback)
optionmenu_1.pack(pady=10, padx=10)
2022-05-30 18:20:27 +03:00
app.mainloop()