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

ttk::progressbar can't be disabled ?

79 views
Skip to first unread message

lamuzz...@gmail.com

unread,
Jan 15, 2024, 7:37:41 PM1/15/24
to
Testing this ( 8.6.11 - Win7 32 )

package require Tk

set p [ttk::progressbar .progreso -orient horizontal -mode indeterminate]
set b [ttk::button .boton -text "Disable pb" -command "$p configure -state disabled" ]
pack $b $p -fill both -expand 1
$p start 5

i get this error

unknown option "-state"
unknown option "-state"
while executing
".progreso configure -state disabled" (...etc ... )

It seems like progressbar can't be disabled (however the documentation doesn't mention this ).
Isn't possible set the state of this widget ?

Alejandro

Luc

unread,
Jan 15, 2024, 8:06:28 PM1/15/24
to
**************************

Maybe this is what you want?

set p [ttk::progressbar .progreso -orient horizontal -mode indeterminate]
set b [ttk::button .boton -text "Disable pb" -command "$p stop" ]
pack $b $p -fill both -expand 1
$p start 5

--
Luc
>>

Luc

unread,
Jan 15, 2024, 8:19:30 PM1/15/24
to
**************************

Also, note that the correct way of setting the state of a progress bar is
$p state disabled

You don't use -configure


So you could do this:

set p [ttk::progressbar .progreso -orient horizontal -mode indeterminate]
set b [ttk::button .boton -text "Disable pb" -command "$p state disabled; puts \"state now is [$p state disabled]\""]
pack $b $p -fill both -expand 1
puts "state is [$p state disabled]"
$p start 5


Now, what purpose this 'state' command ever serves in a progress bar is
beyond me.

--
Luc
>>

lamuzz...@gmail.com

unread,
Jan 15, 2024, 10:14:11 PM1/15/24
to
Hi Luc,

actually i want to disabled it, not stop it.
Using your example, i got first
>> state is
and after click in the button
>> state now is !disabled

by the way, the progressbar remains enabled all time.

Saludos,
Alejandro




Luc

unread,
Jan 15, 2024, 11:24:22 PM1/15/24
to
**************************

What do you mean by "disabled"?

I don't know what a disabled progress bar is.


--
Luc
>>

lamuzz...@gmail.com

unread,
Jan 16, 2024, 6:10:56 PM1/16/24
to
>>> What do you mean by "disabled"?
>>> I don't know what a disabled progress bar is

Well, is like a disabled button ... but with progressbar.
May be this is a silly question but jokes aside, is still valid.
Saludos,
Alejandro

Rich

unread,
Jan 16, 2024, 9:44:28 PM1/16/24
to
Except that "disabled" is an odd state to reason about for a "progress
bar".

Buttons are active items that accept user interaction (click on
button). "Disablement" for a button makes sense as it prevents
"activation" of the button until it is later enabled.

A progress bar (at least a normal one) is a "one-way" widget. It
conveys information to a user, but there is usually no "interaction"
from the user (no clicking on the bar to do something). Therefore,
with no "interaction", there is nothing to "disable", and setting it to
"disabled" is an odd state to ask about.


lamuzz...@gmail.com

unread,
Jan 16, 2024, 10:39:49 PM1/16/24
to
El martes, 16 de enero de 2024 a la(s) 11:44:28 p.m. UTC-3, Rich escribió:

>> Buttons are active items that accept user interaction (click on
>> button). "Disablement" for a button makes sense as it prevents
>> "activation" of the button until it is later enabled.

Ok, but what about labels then ?.
You can to configure the state of labels to "disabled" or "readonly", for example.
How the user interact with a label ?
Odd?. May be. But you can disable a label if you want ...

Alejandro

Rich

unread,
Jan 17, 2024, 12:12:52 AM1/17/24
to
Ok, that's fair. No interaction with a label, but it can still be
disabled.

And..., I should have consulted the docs before replying previously:

For ttk widgets, disablement is one of the "state" flags that is
controled by the 'state' sub-command, not by 'configure -state' like
with traditional Tk widgets:

$ rlwrap wish
% ttk::progressbar .pb
.pb
% .pb state
% .pb state disabled
!disabled
% .pb state
disabled
%

Read about it in the progressbar man page and the ttk::widget man page.

The Bjornsdottirs - Ellenor

unread,
Jan 18, 2024, 1:38:08 AM1/18/24
to
Disabled progress bars are sometimes used if a task has finished or is
suspended. They should be shown differently to non-disabled progress bars.

Sometimes, progress bars are overlaid with an invisible slider widget. (I
don't recommend this, it's hard to get right.) Disabled would mean
disabling that invisible slider, in that case.

--
Ellenor Bjornsdottir <ze...@umbrellix.net> Pan makes it quite difficult to
set a multi-line signature. Some say it should be that way. Most of those
people already have us on their killfile.

Luc

unread,
Jan 18, 2024, 12:12:11 PM1/18/24
to
On Thu, 18 Jan 2024 06:38:04 -0000 (UTC), The Bjornsdottirs - Ellenor wrote:

>Disabled progress bars are sometimes used if a task has finished or is
>suspended. They should be shown differently to non-disabled progress bars.
>
>Sometimes, progress bars are overlaid with an invisible slider widget. (I
>don't recommend this, it's hard to get right.) Disabled would mean
>disabling that invisible slider, in that case.


Your words make sense to me, but the whole won't until someone explains
how that "disabled" state is different from a stopped progress bar.


--
Luc
>>

0 new messages