Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Install Tk Theme

320 views
Skip to first unread message

kellyo...@gmail.com

unread,
Jan 29, 2020, 12:57:47 PM1/29/20
to
I am experimenting with Tk and Themes. I have problems understanding the way a new theme is added to my installation. I would like to add the awt themes available here: https://sourceforge.net/projects/tcl-awthemes/

On Windows, as far as I understand, I simply need to unzip the files and put the folder into the directory where all my Tcl modules go. This is what I have done. The folder is now in my lib folder, the same directory where I have put modules which I can access with "require". However, if I use

ttk::style theme names

only the standard themes are available.

Can somebody point to what I have to do to try out new themes?

Thank you
KElly

Brad Lanam

unread,
Jan 29, 2020, 1:39:37 PM1/29/20
to
package require awdark
package require awlight

If you have tksvg available, then:

package require black
package require winxpblue

And then

ttk::style theme use <theme>

What is the layout of your directory where the "tcl modules go"?


tedbr...@gmail.com

unread,
Jan 29, 2020, 2:39:32 PM1/29/20
to
On Wednesday, January 29, 2020 at 10:39:37 AM UTC-8, Brad Lanam wrote:

>
> package require awdark
>
>
> If you have tksvg available, then:
>

When I try this on my windows 10 system, I get an error.

I don't have tksvg as a package, and when I do the above
it gets an error in _createCombobox because the if test
for $vars(have.tksvg) is false and so the variable wid does
not get set and the error occurs following the if on the
ttk::style configure statement.

Although it errors out at that point, if I catch it, it will
have got far enough so OP's ttk::style theme names
will report the aw themes, but they still don't work. At least
they aren't dark.

On androwish, I use the awthemes with no problems at all.

Brad Lanam

unread,
Jan 29, 2020, 3:27:07 PM1/29/20
to
That problem with no tksvg and $wid has been fixed in the latest version that
is available for download on sourceforge.

tedbr...@gmail.com

unread,
Jan 29, 2020, 4:25:23 PM1/29/20
to
On Wednesday, January 29, 2020 at 12:27:07 PM UTC-8, Brad Lanam wrote:

>
> That problem with no tksvg and $wid has been fixed in the latest version that
> is available for download on sourceforge.

Thanks, I'll have to grab it, the big green download button
still points to 7.6, hadn't seen the links below that.

Brad Lanam

unread,
Jan 29, 2020, 6:38:09 PM1/29/20
to
Hmm, yes, I forgot to set the "latest" download.
That's been fixed.

kellyo...@gmail.com

unread,
Jan 30, 2020, 2:33:22 AM1/30/20
to
Thank you! I managed to have it installed and running! Nice job, Brad!

I have a question, which is a bit off-topic, but since you are the creator of the theme... I want to use the dark theme to match the dark mode of Windows. I have to say, my application looks very nice in dark. However, the main menu, as well as text widgets, do not get the dark theme. Is this intended, or is there something I can set to get everything dark?

Thank you in advanced for this wonderful theme.

Kelly

Brad Lanam

unread,
Jan 30, 2020, 9:13:49 AM1/30/20
to
On Wednesday, January 29, 2020 at 11:33:22 PM UTC-8, kellyo...@gmail.com wrote:
> Thank you! I managed to have it installed and running! Nice job, Brad!
>
> I have a question, which is a bit off-topic, but since you are the creator of the theme... I want to use the dark theme to match the dark mode of Windows. I have to say, my application looks very nice in dark. However, the main menu, as well as text widgets, do not get the dark theme. Is this intended, or is there something I can set to get everything dark?

There are some helper routines supplied with the theme.
The if statement protects the procedure call in case some other
theme without these routines is in use.

set theme [ttk::style theme use]

if { [info commands ::ttk::theme::${theme}::setMenuColors] ne {} } {
::ttk::theme::${theme}::setMenuColors .mymenu
}
if { [info commands ::ttk::theme::${theme}::setTextColors] ne {} } {
::ttk::theme::${theme}::setTextColors .mytext
}
if { [info commands ::ttk::theme::${theme}::setListboxColors] ne {} } {
::ttk::theme::${theme}::setListboxColors .mylistbox
}

welle...@googlemail.com

unread,
Feb 19, 2020, 2:22:20 PM2/19/20
to
Hi Brad,

the dark theme looks amazing! I do not get quite the point of your last post about the helper routines, though. I am trying to get the menu to go dark. Do I have to insert this routine in my code, if yes, just after the set statement? Sorry for the naive question.

Welle

Brad Lanam

unread,
Feb 19, 2020, 3:43:15 PM2/19/20
to
The code has to be run for each menu you create.

Brad Lanam

unread,
Feb 19, 2020, 3:44:34 PM2/19/20
to
If you look at the demottk.tcl program, it has a little for loop that
sets the colors for each menu.

welle...@googlemail.com

unread,
Feb 19, 2020, 4:14:20 PM2/19/20
to
Taking the Listbox example, which seems easier

package require awdark
ttk::style theme use awdark

listbox .list -height 3
pack .list -expand 1 -fill both
if { [info commands ::ttk::theme::awdark::setListboxColors ] ne {} } {
::ttk::theme::awdark::setListboxColors .list
}

It is like this?

Brad Lanam

unread,
Feb 19, 2020, 6:40:06 PM2/19/20
to
Yes.

welle...@googlemail.com

unread,
Feb 20, 2020, 3:22:51 AM2/20/20
to
Perfect! Thank you!
0 new messages