CTkScrollableDropdown
CTkScrollableDropdown copied to clipboard
.get() .cget() and command attribute override
I had a combobox that calls a function when selected, I attached the scrollable list and the combobox doesnt detect a selection, I removed the command from the ctk combobox and put it in the scrollable list and it did register a selection but stopped inserting the selection into the ctk combobox
code before implentation:
self.time_combobox = ctk.CTkComboBox(temporal_frame, values=self.available_years, border_width=0,
command=self.on_select_temporal)
self.time_combobox.grid(column=0, row=2,sticky='WE', padx=8, pady=(4,8))
self.time_combobox.set('')
def on_select_temporal(self, event = None):
print('test', self.time_combobox.get("text"))
works fine
after the dropdown implentation:
self.time_combobox = ctk.CTkComboBox(temporal_frame, border_width=0, command=self.on_select_temporal)
self.time_combobox.grid(column=0, row=2,sticky='WE', padx=8, pady=(4,8))
self.scrollable_combobox = CTkScrollableDropdown(self.time_combobox, values=self.available_years, justify="left",
button_color="transparent", width= 260, frame_border_width=1, command=self.on_select_temporal)
self.time_combobox.set('')
def on_select_temporal(self, event = None):
print('test', self.scrollable_combobox.cget("text"))
note: I used the cget() because the get() didnt work
Noticed this issue too. But it can be done, a bit tricky though. You can get the value of the method directly: self.scrollable_combobox.values