Akascape / CTkScrollableDropdown

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

Autocomplete - Bug or limitation? #54

Open Demsli opened 3 weeks ago

Demsli commented 3 weeks ago

I am testing the autocomplete feature on CTKComboBox. Noticed that when I start typing the name - it only includes values that start with this name. The list of values is ["Great Britain", "British Isles", "Dialect British"]. So I started typing "Brit" and was expecting all three values to comeup. Yet got the only one - British Isles. Is it a bug or some limitation? Can it be the issue with the fact that I am taking values from google sheet names? The code is written like so: self.sheet_name_prettified = CTkScrollableDropdown(attach=self.sheet_name, values=[worksheet.title for worksheet in self.spreadsheet.worksheets()], fg_color=('white', '#1D1E21'), text_color=('black', 'white'), button_color=('white', '#1D1E21'), hover='disabled', width=200, justify='center', autocomplete=True)

Will be glad to hear any tipps how to fix it. Thanks in advance:)

Demsli commented 3 weeks ago

Found the fix. def live_update in ctk_scrollable_dropdown.py had a variable similar that was written like this: similar = s.startswith(string) or text_similarity > 0.75 Changing it to this improved searching: similar = string in s or text_similarity > 0.75