Akascape / CTkScrollableDropdown

Easily add a new scrollable dropdown menu in customtkinter widgets (extension/add-on)
MIT License
113 stars 10 forks source link

It doesn't work #52

Open limafresh opened 2 months ago

limafresh commented 2 months ago

I inserted CTkScrollableDropdown on CTkCombobox where there are many items, and now this Combobox stops opening. It's a pity that this is so, the project is useful and I wanted to apply it to my project "Brushshe" (in my repository).

def text_settings(self):
        def change_text_size(size):
            self.font_size = int(size)
            self.tx_size_label.configure(text=self.font_size)

        def combobox_callback(value):
            self.tk_font = CTkFont(family=value, size=self.font_size)

        text_settings = CTkToplevel(app)
        text_settings.title("Налаштувати текст")
        self.tx_size_label = CTkLabel(text_settings, text=self.font_size)
        self.tx_size_label.pack()
        tx_size_slider = CTkSlider(text_settings, from_=11, to=96, command=change_text_size)
        tx_size_slider.set(self.font_size)
        tx_size_slider.pack()

        fonts_label = CTkLabel(text_settings, text="Шрифти з системи:")
        fonts_label.pack()
        fonts = list(font.families())
        fonts_combobox = CTkComboBox(text_settings, command=combobox_callback)
        fonts_combobox.set(self.tk_font['family'])
        fonts_combobox.pack()
        CTkScrollableDropdown(fonts_combobox, values=fonts)

The Combobox itself is there, but I can't expand its items.

Akascape commented 2 months ago

@l1mafresh Use CTkScrollableDropdownFrame instead of CTkScrollableDropdown (Toplevel)

limafresh commented 2 months ago

CTkScrollableDropdown

I already tried changing it to CTkScrollableDropdownFrame. The result - with CTkScrollableDropdown at least the text on the CTkCombobox was visible, and with CTkScrollableDropdownFrame - only an empty combobox with no text on it.

Akascape commented 2 months ago

@l1mafresh Can you provide a full example which I can test?

limafresh commented 2 months ago

@l1mafresh Can you provide a full example which I can test?

with CTkScrollableDropdown with CTkScrollableDropdown CTkScrollableDropdownFrame with CTkScrollableDropdownFrame

Download code with CTkScrollableDropdown: Brushshe.zip