Skip to content

Performance issue #11

Description

@PyHubs

The UI framework is INCREDIBLY leggy/slow. Please fix this issue because it looks very good and I will like to use it in my future projects. I noticed the images are the main thing that are slow.

Activity

  1. self-assigned this
    on Jun 2, 2021
  2. rdbende commented on Jun 2, 2021

    @rdbende
    Owner

    Unfortunately, I can’t deal with that right now, but I'll look at it as soon as I have time.
    The problem here is that almost all images are 20x20 pixels and tk has to repeat these to draw a widget. For some widgets, scaling to a larger size is not possible, but for a LabelFrame, Notebook, or Treeview border it can definitely be useful.

  3. RedFantom commented on Jun 2, 2021

    @RedFantom

    In my experience, pixmap themes in ttk can be slow with a large number of widgets if the pixmaps contain an alpha channel, which the PNG images of this theme do. The only reliable way to speed it up is to convert the images to a format like GIF, where pixels can be absolutely transparent but not partially. To do this nicely, it is required to blend the partially-transparent pixels with the background colour of choice and then convert to a GIF file.

    Sometimes a bug may exist in a theme that makes it slow and a small adjustment can help. plastik was very slow due to an issue in one of the Notebook pixmap specifications. However, such a level of slowness you really can't get around, and from the example for this theme, I'm pretty sure no such issues exist here.

    I think this has little to do with the theme itself, and mostly with Tk/ttk. Tk/ttk was just not built in a time when transparency was available in most image formats, let alone used a lot in UIs. Making themes without true alpha channels is merely a work-around for an issue that will probably never go away. But it's a good, reliable work-around nonetheless.

  4. rdbende commented on Jun 3, 2021

    @rdbende
    Owner

    I think the complete elimination of the alpha channel as a good idea, but there is something else here. I’ve noticed that inside a LabelFrame or Notebook, Tk/ttk renders the state change of widgets much more slowly than outside them. This is definitely due to the small image size of the borders.

  5. changed the title [-]Laggy[/-] [+]Performance issue[/+] on Jun 3, 2021
  6. rdbende commented on Jun 18, 2021

    @rdbende
    Owner

    In v1.4 I tried to remove all the transparency, unfortunately, it still remains, but on Ubuntu, it works perfectly well, but I'm not happy with the performance of Windows, although it might be possible with gifs, unfortunately, I'm not friended with them, so this won't happen for a time.
    Anyway, be sure to check out the release with new widget styles!

  7. PyHubs commented on Jun 19, 2021

    @PyHubs
    Author

    Alright rbende. But i dont now really need to work on GUIS but for the next project ill need GUIS will see :)

  8. pinned this issue on Jun 19, 2021
  9. RedFantom commented on Jun 19, 2021

    @RedFantom

    @rdbende A little while ago I actually made a GIF-version of the theme in my fork. Feel free to check it out, though it's not for azure dark. I did it with an automated script, some touch-ups might be needed.

  10. rdbende commented on Jun 19, 2021

    @rdbende
    Owner

    Thanks for the tip, I wrote my own Pillow converter, so that's no problem now. I know it would have been faster with some ImageMagick and shell stuff, but I prefer Python and Pillow.
    However I noticed that the png images aren't perfect either, somehow an extra pixel slipped in, so I'll fix it sometime. 🤔️

  11. unpinned this issue on Apr 2, 2022
  12. bosd commented on Jun 26, 2022

    @bosd

    @RedFantom Does your fork solve(/improve) the performance issue?

  13. bosd commented on Jun 26, 2022

    @bosd

    How about SVG images?? What is the reason the Sunvalley SVG version exsists?

  14. rdbende commented on Jun 27, 2022

    @rdbende
    Owner

    The SVG-based theme was just an experiment with the Tksvg package, and in theory it should improve the appearance on high DPI displays, tho I couldn't try it out.
    I think it makes the performance even worse.

  15. RedFantom commented on Jun 28, 2022

    @RedFantom

    @bosd The fact that Tkinter is slow when using PNG-pixmap themes is well-documented, and this may be alleviated by using GIF-pixmap themes.

    If you need higher performance than a GIF-pixmap theme can provide, you have to look outside of pixmap themes altogether.

    I'd like to point out that @rdbende has made a GIF version also, and it's probably better than my quick-and-dirty conversion.

    SVG probably makes it worse, especially on first load, because the images have to be rendered to pixmaps before they can be used by Tkinter. The high DPI images will be bigger, and hence the transformations that are applied to build UI elements from them will probably be a bit slower indeed. I think on low DPI screens it should not make (much of) a difference.

  16. EDETNAOZERO commented on Aug 30, 2025

    @EDETNAOZERO

    Performance of gif-based theme is ok but i see some situations where it is not as performant as i want. I'd like to allow users to switch back to one of the default ttk themes because of this but i don't know how, because this theme set heavily modifies a lot of colors and after using something like
    ttk::style theme use winnative
    it looks really ugly.
    Could you please add the backward switching example in your azure.tcl?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions