From: Jerzy K. <jer...@un...> - 2012-05-21 20:52:43
|
Bruce Sherwood answers : > I can't think of a way to do that within the existing structure. to: > Sophie: >> Is there any way to do event-driven programming, with callbacks for mouse or keyboard events? I would rather not use the polling style shown in example on the web site. >> Event-driven style is not magic, and if you will to pay the price of some indirections, YOU CAN implement it yourself. You may also introduce "user events" not related to any hardware action, but which implement asynchronous loops. This small program is a very primitive "planetary system", with looping and mouse/keyboard control based on "events". Alt-click adds a random planet, just click stops the motion. There is nothing more. http://users.info.unicaen.fr/~karczma/TEACH/Anima/Progs/psystem.py Good luck. Jerzy Karczmarczuk |