rdbende / Sun-Valley-ttk-theme

A gorgeous theme for Tkinter/ttk, based on the Sun Valley visual style ✨
https://pypi.org/project/sv-ttk
MIT License
1.87k stars 110 forks source link

Combobox selection error #136

Open Nitaki-dev opened 4 months ago

Nitaki-dev commented 4 months ago

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

rdbende commented 4 months ago

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.

Nitaki-dev commented 4 months ago

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

rdbende commented 4 months ago

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 commented 4 months ago

default theme: Képernyőfelvétel 2024-04-27 18-34-41.webm

rdbende commented 4 months ago

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

Nitaki-dev commented 4 months ago

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?

LaG1924 commented 3 weeks ago

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)