From: Mona on
Hi,

I am using the ttk::progressbar. I am sending the percent value to
increase the progressbar to that "percent value". I would like to
have the progressbar move between the values I sent, but I don't know
how long it will take to finish the step i.e. to run the code between
those 2 values.

toplevel .t;
::ttk::progressbar .t.pb configure -variable ::newvalue -mode
determinate;
pack .t.pb;

# Sending first percent value = 10;
set ::newvalue 10;

# Do some code, partA. Dont; know how long it will take to run this
code
..........................
.......................
......................
#Code, partA finished, Sending second percent value 30
set ::newvalue 30;
############################################

I would like the progressbar to keep moving while the code, partA is
being executed, without it going beyond the second percent value( in
this case, 30). How can I do this?

Thanks,
Mona.
From: Donal K. Fellows on
On 16 Nov, 10:10, Mona <impm...(a)yahoo.com> wrote:
> I am using the ttk::progressbar.  I am sending the percent value to
> increase the progressbar to that "percent value".  I would like to
> have the progressbar move between the values I sent, but I don't know
> how long it will take to finish the step i.e. to run the code between
> those 2 values.
[...]
> I would like the progressbar to keep moving while the code, partA is
> being executed, without it going beyond the second percent value( in
> this case, 30).  How can I do this?

You have to define points through the code that define how far it has
got and update the progress bar at those times (possibly including an
[update], though be careful with that). There's just no other way to
do it that is sane and effective (e.g., if you were to guess a rate of
advancement and get it too fast, then you'd overshoot) unless you've
got an extension that defines a Tcl interface to a magic crystal
ball. :-)

If your long-running processing really is that uncertain, maybe just
use the indefinite progress bar instead? (Yes, not great but sometimes
you just don't get perfection.)

Donal.