rdbende / Azure-ttk-theme

A stunning modern theme for ttk inspired by Fluent Design 💠
MIT License
739 stars 136 forks source link

Treeview expands on theme change #40

Closed francoisrob closed 1 year ago

francoisrob commented 2 years ago

The treeview component resizes when switching between light and dark mode and just increasing in width

rdbende commented 2 years ago

This is a known bug. Over the last two years, I have tried several times to find out why does it resize, but I could not figure it out.

oehhar commented 2 years ago

Thanks for great rdbene themes !

May I just ask as a side note to this issue: Did you consider to file a bug in the Tk project? https://core.tcl-lang.org/tk/ticket

Note, that it is required to login as anonymous with the ASCII-art password shown on the login page.

Recently, many efforts were done to attack all bugs in Tk.

If you have a test script, I may also try it.

Thank you, Harald

francoisrob commented 2 years ago

This is a known bug. Over the last two years, I have tried several times to find out why does it resize, but I could not figure it out.

Do you maybe have a workaround or should I just refrain from using the treeview for now

rdbende commented 2 years ago

@oehhar

I tested several different themes, and it turns out that the problem happens when the theme uses a custom image for the Treeview.field element.

Here is a short script that illustrates the bug. Every time you click the "theme use" button, the treeview expands horizontally.

package require Tk 8.6

image create photo tree -data {
iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAnXAAAJ1wG
xbhe3AAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAACJJREFUOI
1jPLF9+38GKgImaho2auCogaMGjho4auBQMhAAyR0DXUEyypsAAAAASUVORK5CYII=
}

ttk::style theme create my_theme -parent clam -settings {
    ttk::style element create Treeview.field image tree
}

pack [ttk::treeview .tree]
pack [ttk::button .btn -text "theme use" -command {ttk::style theme use my_theme}]

ttk::style theme use my_theme

I will open a ticket in the Tk core about this bug.

oehhar commented 2 years ago

Great finding. Please don't forget to mention the Tk version.

Take care, Harald

rdbende commented 2 years ago

https://core.tcl-lang.org/tk/tktview?name=bc602049ab

fvogelnew1 commented 2 years ago

The ticket has been addressed, please comment there.

rdbende commented 2 years ago

Ahh, I feel so newbie I don't know how to comment on a Fossil ticket. @fvogelnew1 Anyways, thanks for your feedback. Using -width 0 -height 0 kind of makes sense now. I'll fix my themes with this tomorrow!

fvogelnew1 commented 2 years ago

Commenting a Fossil ticket is done by clicking on the Edit button.

oehhar commented 2 years ago

I want to thank the great tk team to have fixed this (Peter, Alexandre). Just a remark on fossil:

Thank you all, Harald

rdbende commented 2 years ago

Commenting a Fossil ticket is done by clicking on the Edit button.

Lol it's just too obvious 😅. Thanks!

fvogelnew1 commented 2 years ago

Thanks for your feedback in the Tk ticket. I have now closed this ticket.