Skip to content

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

@FaridAlmaulaui1

Description

@FaridAlmaulaui1

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions