Re: Event-driven / callback programming of mouse or keyboard

Jerzy Karczmarczuk <[email protected]> Tue, 22 May 2012 11:00:24 +0200
Newsgroups gmane.comp.python.visualpython.user
Organization UCBN
Message-ID <[email protected]>
Bruce Sherwood :
> I too thought of a way to introduce a callback, by using threads (this
> is based on the scheme used in the graphing module, vis/graph.py, to
> enable the feature that dragging the mouse shows crosshairs on a
> graph).
>
> from visual import *
> ...
> while True:
>      rate(100)
>      if run: b.rotate(angle=.01, axis=(0,1,0))
This is nice and may be very useful; in general I think that VP is 
underused in the domain of simulation (+visu+measuring, for pedagogical 
purposes) despite quite a number of applications.

But you might remember our short discussion some months ago. I 
discovered that rate() doesn't work well with threads in general. This 
directive introduces a time-consumming loop. The event processing with 
timers should be low-level (in my understanding of this stuff).

The best.

Jerzy Karczmarczuk


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/