> I will have a look at the code for both PyGTK and OS X. > Hopefully that will show me more of the best way of > handling this.
The code in PyGTK is a bit easier to understand than the code for OS X. The OS X code also includes stuff to handle SIGINTs (keyboard interrupts by ctrl-c), which is nice but not really essential. > But, what happens if PyOS_InputHook is called > repeatedly. Are you not then starting the event loop > multiple times. Can you say more about what happens in > this case? On the first call to PyOS_InputHook, you start the event loop, and you stay in the event loop until some input is available on stdin. So Python never gets the chance to call PyOS_InputHook repeatedly. Depending on if and how readline is installed, it is possible that once input is available on stdin and PyOS_InputHook exits, PyOS_InputHook is called a second time. But that doesn't do any real damage: the event loop is restarted, but it exits immediately because input is available on stdin. It's good to double-check that that works on wx though. Another option is to write your hook function as follows: check if any input is available on stdin; if so, return add fileno(stdin) to the set of file descriptors to be watched by the event loop start the event loop; if input is available on stdin, exit the event loop and return --Michiel. ------------------------------------------------------------------------------ Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use existing skills and code to build responsive, highly engaging applications that combine the power of local resources and data with the reach of the web. Download the Adobe AIR SDK and Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel