Re: Push to Make (Single Pole) Button running a loop
- From: "Hendrik van Rooyen" <mail@xxxxxxxxxxxxxxx>
- Date: Mon, 31 Dec 2007 09:33:53 +0200
"Jon Todd" <jo...en.co.uk> wrote:
I'd like to have a button that when pressed executes a loop (this could be a
thread) and then stops execution when it's released (Push to Make - Single
Pole in electronics terms).
I've tried the regular way of associating the procedure with a callback and
tried using <Button-1> and <ButtonRelease-1> bindings but am getting nowhere
fast (in the latter case the button release event seems to occur anyhows).
You are a bit stymied :
Afaik, Button needs the click on the button, leaving it depressed,
while ButtonRelease needs a click on the button, and the release can be anywhere
for drag and drop implementation. So it is possible to call two routines with
one
click and release.
But there is another hassle - you would have to code the loop as a separate
thread,
started by the first, while the second routine sets some variable that is
checked by
the loop to kill itself, as the GUI will not be responsive until the first
command
returns, because the command "captures" the main loop...
HTH - Hendrik
.
- References:
- Push to Make (Single Pole) Button running a loop
- From: Jon Todd
- Push to Make (Single Pole) Button running a loop
- Prev by Date: Re: ElementTree should parse string and file in teh same way
- Next by Date: Re: Bizarre behavior with mutable default arguments
- Previous by thread: Push to Make (Single Pole) Button running a loop
- Next by thread: Sub-classing unicode: getting the unicode value
- Index(es):