mirror of
https://github.com/TomSchimansky/CustomTkinter.git
synced 2023-08-10 21:13:13 +03:00
Fixed variable configuring for CTkOptionMennu
This commit is contained in:
parent
89fa0a8758
commit
dab93a6a5e
@ -226,7 +226,8 @@ class CTkOptionMenu(CTkBaseClass):
|
||||
|
||||
if self.variable is not None and self.variable != "":
|
||||
self.variable_callback_name = self.variable.trace_add("write", self.variable_callback)
|
||||
self.set(self.variable.get(), block_set_variable=True)
|
||||
self.current_value = self.variable.get()
|
||||
self.text_label.configure(text=self.current_value)
|
||||
else:
|
||||
self.variable = None
|
||||
|
||||
|
@ -78,8 +78,9 @@ switch_2 = customtkinter.CTkSwitch(master=app, variable=s_var, textvariable=s_va
|
||||
switch_2.pack(pady=20, padx=10)
|
||||
|
||||
optionmenu_var = tkinter.StringVar(value="test")
|
||||
optionmenu_1 = customtkinter.CTkOptionMenu(master=app, variable=optionmenu_var, values=["Option 1", "Option 2", "Option 3"])
|
||||
optionmenu_1 = customtkinter.CTkOptionMenu(master=app, variable=None, values=["Option 1", "Option 2", "Option 3"])
|
||||
optionmenu_1.pack(pady=20, padx=10)
|
||||
optionmenu_1.configure(variable=optionmenu_var)
|
||||
combobox_1 = customtkinter.CTkComboBox(master=app, values=["Option 1", "Option 2", "Option 3"])
|
||||
combobox_1.pack(pady=20, padx=10)
|
||||
combobox_1.configure(variable=optionmenu_var)
|
||||
|
Loading…
Reference in New Issue
Block a user