Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.get() .cget() and command attribute override #53

Open
FaridAlmaulaui1 opened this issue Oct 17, 2024 · 1 comment
Open

.get() .cget() and command attribute override #53

FaridAlmaulaui1 opened this issue Oct 17, 2024 · 1 comment

Comments

@FaridAlmaulaui1
Copy link

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

@Demsli
Copy link

Demsli commented Nov 4, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants