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

Thickness of ttk::progressbar cannot be changed

150 views
Skip to first unread message

Alexandru

unread,
Jul 15, 2015, 8:27:43 AM7/15/15
to
Hi,

why is it that I cannot change the thickness of the ttk::progress bar? I'm using a style to achieve that:

set progress 50
ttk::style configure My.Horizontal.TProgressbar -background green -thickness 1
pack [ttk::progressbar .progress -orient horizontal -mode determinate -maximum 100 -variable progress] -expand 0 -fill x -side top
.progress configure -style "My.Horizontal.TProgressbar"

Code tested under Windows 7 64 Bit Professional

Thanks!

Arjen Markus

unread,
Jul 15, 2015, 9:52:16 AM7/15/15
to
Op woensdag 15 juli 2015 14:27:43 UTC+2 schreef Alexandru:
It could be that the thickness is determined by the bitmaps that make the progress bar. Just a guess, mind you.

Regards,

Arjen

Arjen Markus

unread,
Jul 15, 2015, 9:54:29 AM7/15/15
to
Op woensdag 15 juli 2015 15:52:16 UTC+2 schreef Arjen Markus:
Actually, there is no option -thickness or something resembling it (at least not in the documentation I have).

Regards,

Arjen

Alexandru

unread,
Jul 15, 2015, 9:57:22 AM7/15/15
to
I remember, that on another Windows system, the above code it worked. My assumption was, that that system used another Windows Theme.

But anyhow, how can I change the thickness of the progress bar?

Brad Lanam

unread,
Jul 15, 2015, 1:30:13 PM7/15/15
to
On Wednesday, July 15, 2015 at 6:57:22 AM UTC-7, Alexandru wrote:
> I remember, that on another Windows system, the above code it worked. My assumption was, that that system used another Windows Theme.
>
> But anyhow, how can I change the thickness of the progress bar?

Not if you are using the native windows theme. If you change the theme, you will be able to adjust the thickness.

But you will lose a lot of the native look and feel.

Christian Gollwitzer

unread,
Jul 15, 2015, 2:17:43 PM7/15/15
to
Am 15.07.15 um 14:27 schrieb Alexandru:
> why is it that I cannot change the thickness of the ttk::progress bar?

You can force it by the geometry manager:

pack [ttk::progressbar .t -value 30] -expand yes -fill both

Just tried that you can adjust the size as you wish under Windows. But
as others said, you should be careful not to disturb the native look.

Christian
Message has been deleted

Alexandru

unread,
Jul 15, 2015, 5:00:33 PM7/15/15
to
> You can force it by the geometry manager:
>
> pack [ttk::progressbar .t -value 30] -expand yes -fill both
>
> Just tried that you can adjust the size as you wish under Windows. But
> as others said, you should be careful not to disturb the native look.
>
> Christian


Yes, that seems to be the right direction.

But I still have a problem, as I want to make the thickness thiner than the standard thickness:

If I pack the progress bar directly into the main window, the thickness will be very big.

If I pack the progress bar in one of the sub-frames, the thickness never gets thinner than the standard value.

Brad Lanam

unread,
Jul 16, 2015, 1:30:44 PM7/16/15
to
This sort of works...it seems to want to position the left side of the progress bar at the center of the subframe. You'll have to play around with the settings.

package require Tk

set progress 50
ttk::frame .a -height 10
pack .a

ttk::style configure My.Horizontal.TProgressbar \
-background green -thickness 1
place [ttk::progressbar .progress -orient horizontal \
-mode determinate -maximum 100 -variable progress] \
-in .a -relheight 1.0 -x -50
.progress configure -style "My.Horizontal.TProgressbar"

Alexandru

unread,
Jul 16, 2015, 3:57:44 PM7/16/15
to
Yeah! Thanks Brad, your code works perfectly. Actually we don't need the style anymore. This is my final code:

set progress 50
pack [ttk::frame .a -height 10] -expand 1 -fill x
place [ttk::progressbar .progress -orient horizontal -mode determinate -maximum 100 -variable progress] -in .a -relheight 1.0 -relwidth 1.0

Alexandru

unread,
Jul 16, 2015, 10:47:06 PM7/16/15
to
I have added this solution to the wiki: http://wiki.tcl.tk/20059
0 new messages