TkinterEP / ttkthemes

A group of themes for the ttk extenstions for Tkinter
GNU General Public License v3.0
364 stars 47 forks source link

Document Tcl loading mechanism #45

Closed Akuli closed 5 years ago

Akuli commented 6 years ago

I really like this library, but it can't be used without tkinter. Would it be possible to refactor the library so that the themes could be loaded directly from Tcl? The themes are just Tcl code, so it shouldn't be hard. If it's already doable, I would appreciate some documentation that shows how to load all themes from Tcl code.

RedFantom commented 6 years ago

I have been following some basic Tcl tutorials to understand how other code than just the themes work, and I could split the library into two separate parts. However, for now it is already possible to load the themes into Tcl, it's just a little more complicated than using the Python package.

In the Tcl file you would like to load the themes, you can use

package require Tk 8.4
source ../path/to/themes/pkgIndex.tcl

If you load Tk elsewhere in your library, you can skip the package require line. After that, the themes are available as normal ttk themes, and can be loaded using

ttk::setTheme theme_name

Each pkgIndex.tcl provides the themes in its sub-folders. Some documentation is indeed probaby a good idea. I will see what I can do when I get back to working on it.

Akuli commented 6 years ago

Tk 8.4 is quite old. Do the themes really work with it?

Anyway, this looks nice. Thanks :)

RedFantom commented 6 years ago

Yes, all themes should work with it, I believe. I can guarantee it for Tk 8.5 for all GIF themes (or PNG themes too with TkImg), and all themes work with Tk 8.6.

Akuli commented 6 years ago

Nice :)

RedFantom commented 6 years ago

I hope you don't mind that I have marked this issue as the TODO-issue for documenting the Tcl loading mechanism. I will close it once I have sufficiently documented:

Akuli commented 6 years ago

Awesome. I'm especially interested in the last 2 things, the first one is mostly a "nice to know" thing.

RedFantom commented 5 years ago

It has taken me a long time to get to do this, as I have been very busy, but I still wanted to let you know that I have written the documentation. It is available here. If you have the time, please let me know what you think.

Akuli commented 5 years ago

I like it.