2022-05-25 18:04:00 +03:00
|
|
|
from tkinter import *
|
2022-05-26 20:16:01 +03:00
|
|
|
import customtkinter
|
2022-05-25 18:04:00 +03:00
|
|
|
|
2022-05-30 16:48:41 +03:00
|
|
|
ws = customtkinter.CTk()
|
2022-05-25 18:04:00 +03:00
|
|
|
ws.title('PythonGuides')
|
|
|
|
ws.geometry('400x300')
|
|
|
|
|
|
|
|
def display_selected(choice):
|
|
|
|
choice = variable.get()
|
|
|
|
print(choice)
|
|
|
|
|
|
|
|
countries = ['Bahamas','Canada', 'Cuba','United States']
|
|
|
|
|
|
|
|
# setting variable for Integers
|
|
|
|
variable = StringVar()
|
2022-05-26 20:16:01 +03:00
|
|
|
variable.set("test")
|
2022-05-25 18:04:00 +03:00
|
|
|
|
|
|
|
# creating widget
|
2022-05-30 16:48:41 +03:00
|
|
|
optionmenu_tk = OptionMenu(ws, variable, *countries, command=display_selected)
|
|
|
|
optionmenu_tk.pack(pady=10, padx=10)
|
2022-05-25 18:04:00 +03:00
|
|
|
|
2022-05-30 16:48:41 +03:00
|
|
|
optionmenu_1 = customtkinter.CTkOptionMenu(master=ws, variable=variable, values=countries, command=display_selected)
|
2022-05-26 20:16:01 +03:00
|
|
|
optionmenu_1.pack(pady=10, padx=10)
|
2022-05-25 18:04:00 +03:00
|
|
|
|
|
|
|
# infinite loop
|
|
|
|
ws.mainloop()
|