mirror of
https://github.com/TomSchimansky/CustomTkinter.git
synced 2023-08-10 21:13:13 +03:00
small fixes for CTkComboBox
This commit is contained in:
32
test/manual_integration_tests/test_optionmenu_combobox.py
Normal file
32
test/manual_integration_tests/test_optionmenu_combobox.py
Normal file
@@ -0,0 +1,32 @@
|
||||
import tkinter
|
||||
import tkinter.ttk as ttk
|
||||
import customtkinter
|
||||
|
||||
app = customtkinter.CTk()
|
||||
app.title('test_optionmenu.py')
|
||||
app.geometry('400x300')
|
||||
|
||||
|
||||
def select_callback(choice):
|
||||
choice = variable.get()
|
||||
print("display_selected", choice)
|
||||
|
||||
|
||||
countries = ['Bahamas', 'Canada', 'Cuba', 'United States']
|
||||
|
||||
variable = tkinter.StringVar()
|
||||
variable.set("test")
|
||||
|
||||
optionmenu_tk = tkinter.OptionMenu(app, variable, *countries, command=select_callback)
|
||||
optionmenu_tk.pack(pady=10, padx=10)
|
||||
|
||||
optionmenu_1 = customtkinter.CTkOptionMenu(app, variable=variable, values=countries, command=select_callback)
|
||||
optionmenu_1.pack(pady=10, padx=10)
|
||||
|
||||
combobox_tk = ttk.Combobox(app, values=countries)
|
||||
combobox_tk.pack(pady=10, padx=10)
|
||||
|
||||
combobox_1 = customtkinter.CTkComboBox(app, variable=variable, values=countries, command=select_callback)
|
||||
combobox_1.pack(pady=10, padx=10)
|
||||
|
||||
app.mainloop()
|
||||
Reference in New Issue
Block a user