Hendrik van Rooyen wrote:
>  "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
> 
> 
Perhaps besides all the multithreading issues you should be looking at 
different kind
of control/button ei. checkbox or radio button (windows terminology)?

My first experience at GUI with Tk/TCL?? was not a good one due to both
lack of docs and fear it wouldn't work on both LUNUX and vindows.

Wish there was a simple library with basic primitives like create_windows 
resize,
get_client_area and of course some functions to hand of control to the system.
At least for me, that way I could get much further much faster than trying to
find the learn the behavior of all the currently available controls.
Another point I came across recently is that there is no information on proper 
cleanup after TCL, don't remember exactly why it was a problem it is after all 
OOP sy. 
So, you may have to read the sourcecode for everything you are using and it 
ain't easy, 

Good Luck.

Cheers.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to