Some adjustments to ctk_scrollable_dropdown.py #59
+48
−38
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some tweaks and improvements to the functionality and design of "ctk_scrollable_dropdown.py":
Removed "time.sleep" in order to prevent typing delay in combo boxes, a different method may work better in the future to add a delay to the dropdown appearing without the program being paused completely.
When autocomplete is enabled and a string is typed into a combobox that doesn't match any strings in "values", there won't be any dropdown window that appears automatically. Previously, a dropdown would appear and state "No matches"; however, this doesn't seem to be necessary if a combobox is used similarly to an entry box and takes up screen real estate, potentially covering other elements in the window. This could still be useful if the use case requires the user to type a value that is the same as one of the values in the list, so this adjustment isn't crucial and could potentially become an argument instead.
When autocomplete is enabled and a string is typed into a combobox that doesn't match any strings in "values", though the automatic dropdown no longer appears, pressing the dropdown button manually will show all available strings in "values" rather than displaying "No matches", making it easier for users to choose between either their own typed values or the saved list values.
When using a specified background colour for the window/frame/canvas/etc behind the dropdown, there will be either a black or white pixelation (depending on CTk appearance mode) on the outer edge of the rounded corners of the dropdown, which becomes incredibly noticeable unless using the predefined background colour that comes with the Light and Dark appearance modes. This might be an issue specific to Windows, as I haven't tested on other platforms. Regardless, I have made a workaround by adding an argument for "bg_color", which works the same way as some other CTk widgets, where "bg_color" specifies the colour outside of the border, which you would see if the corners are rounded on some CTk widgets, such as buttons. If a color is specified for the "bg_color" argument, the pixelations will become that color, and this could be used by setting "bg_color" to the same color as any element that is behind the dropdown in order to make the pixelation blend in. If no color is specified, it will simply work like the original code which relies on the appearance mode.
Fixed the scaling of the dropdown window, as it originally had extra blank space beneath the lowest button. Also added functionality for the dropdown to resize when displaying autocomplete options, allocating space for just the visible buttons provided by autocomplete.
Fixed a bug where deleting the final character by pressing backspace, then trying to click off the dropdown would require two clicks. This has been fixed by simply withdrawing the dropdown when the combobox has an empty string (""). There was also an issue after this, where, after the dropdown was removed automatically, pressing the button for it would require two clicks. This has been solved by adding "self.hide = True" under the withdraw command.
I hope these adjustments will help!