mirror of
https://github.com/TomSchimansky/CustomTkinter.git
synced 2023-08-10 21:13:13 +03:00
added test_optionmenu.py
This commit is contained in:
parent
15558b4d0f
commit
a50e2ea9ca
@ -1,10 +1,9 @@
|
|||||||
from tkinter import *
|
from tkinter import *
|
||||||
import customtkinter
|
import customtkinter
|
||||||
|
|
||||||
ws = Tk()
|
ws = customtkinter.CTk()
|
||||||
ws.title('PythonGuides')
|
ws.title('PythonGuides')
|
||||||
ws.geometry('400x300')
|
ws.geometry('400x300')
|
||||||
ws.config(bg='#F2B90C')
|
|
||||||
|
|
||||||
def display_selected(choice):
|
def display_selected(choice):
|
||||||
choice = variable.get()
|
choice = variable.get()
|
||||||
@ -17,17 +16,10 @@ variable = StringVar()
|
|||||||
variable.set("test")
|
variable.set("test")
|
||||||
|
|
||||||
# creating widget
|
# creating widget
|
||||||
dropdown = OptionMenu(
|
optionmenu_tk = OptionMenu(ws, variable, *countries, command=display_selected)
|
||||||
ws,
|
optionmenu_tk.pack(pady=10, padx=10)
|
||||||
variable,
|
|
||||||
*countries,
|
|
||||||
command=display_selected
|
|
||||||
)
|
|
||||||
|
|
||||||
# positioning widget
|
optionmenu_1 = customtkinter.CTkOptionMenu(master=ws, variable=variable, values=countries, command=display_selected)
|
||||||
dropdown.pack(pady=10, padx=10)
|
|
||||||
|
|
||||||
optionmenu_1 = customtkinter.CTkOptionMenu(master=ws, values=["option 1", "option 2", "number 42"])
|
|
||||||
optionmenu_1.pack(pady=10, padx=10)
|
optionmenu_1.pack(pady=10, padx=10)
|
||||||
|
|
||||||
# infinite loop
|
# infinite loop
|
Loading…
Reference in New Issue
Block a user