Tk programs spend most of their time doing nothing... just
waiting for events to happen.

Tk runs an event loop that waits for events. As soon as en
event has arrived, it processes it using the script assigned to
the event, the goes back to the event loop. An event could
be a mouse click, a key pressed, ...

However, if your program is busy for a long time, events are not
going to be processed until after your program returns control
to the event loop. Which means your stop button wouldn't
respond.

An artificial way of making sure events are processed during
a long task is to call the "update" command. This will check
the event queue for unprocessed messages.

I would think of something like:

set stopped 0
button .b -text "Stop" -command "set stopped 1"
pack .b

while {!$stopped} {

     ....
     # process the list here, do some long task, whatever
     ...

     # here we allow the event loop do be processed
     update
}

"RJ Ent." wrote:

> Greetings,
>
> At 10:25 PM 1/17/01 -0600, you wrote:
> >If you have a "STOP" button on your GUI, you will need to periodically call
> >'update' during your list processing loop.  That will give some time to the
> >event loop to process
>
> >" the events "
>
> This (the events) is the area I am unsure how to "puase" the script where
> it is.  I have in mind a popup (which I can do) to stop the execution or to
> continue right where it was last.  It is the pausing part I am unsure how
> to tackle.:(
>
> Thoughts?
>
> Many thanks!
> > and tell your application to stop.
>


_______________________________________________
vtcl-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/vtcl-user

Reply via email to