Sun-Valley-ttk-theme icon indicating copy to clipboard operation
Sun-Valley-ttk-theme copied to clipboard

Combobox selection error

Open Auria-dev opened this issue 1 year ago • 7 comments

After selecting any item from a combobox, the text highlight stays, even when the combobox no longer has focus. (in both light and dark theme)

With theme: image

Without theme (how it should be): image

Auria-dev avatar Apr 27 '24 13:04 Auria-dev

Hi, can you share the steps to reproduce this? Last time I checked the behavior was the same with the default theme, and the selection went away when another widget was focused.

rdbende avatar Apr 27 '24 14:04 rdbende

You can recreate this by running the Widget demo, and changing the value of the readonly combobox to anything, and then click on anythingelse to change the focus

Auria-dev avatar Apr 27 '24 14:04 Auria-dev

Hmm, I see no difference, except that with clam the selection is grey when unfocused.

sv-ttk: Képernyőfelvétel 2024-04-27 18-11-26.webm

clam: Képernyőfelvétel 2024-04-27 18-14-03.webm

ps: forgot to record the mouse :D

rdbende avatar Apr 27 '24 16:04 rdbende

And yes, there's a difference between the three, though I'm not sure which behavior sv-ttk should follow.

rdbende avatar Apr 27 '24 16:04 rdbende

huh, weird. for me without any themes it does this:

https://github.com/rdbende/Sun-Valley-ttk-theme/assets/64524466/b672c3b5-af78-4afe-b715-61a7e455a7ad

As you can see, whenever the focus is taken away from the combobox, the blue background disappears. Im not sure if that is how you want sv-ttk to function, but i think thats how it should be. Are there any ways for me to still achieve this?

Auria-dev avatar Apr 27 '24 17:04 Auria-dev

I also encountered this problem. In the default theme, the highlight is removed when the widget loses focus, but in sv-ttk the highlight remains.

The solution for me is as follows (https://stackoverflow.com/a/71531095):

def on_select(event):
    selected = var.get()
    combobox.set("")
    combobox.set(select)
combobox.bind("<<ComboboxSelected>>", on_select)

LaG1924 avatar Aug 15 '24 17:08 LaG1924