event handling

Peter Nemeth pnemeth at fit.edu
Wed Jan 30 12:16:08 EST 2008


Hi ,


I am working on a stellar spectral analysis pipeline in Python. My OS is 
Suse 10.0, and i use Python 2.5 . I have found difficulties with keyboard 
event handling. My code communicates with the user through an xterm window 
and shows graphs in a Gnuplot window. At a certain point i start an 
infinite loop in order to select multiple spectral regions by mouse-clicks 
over the Gnuplot graph. I would like to terminate this loop by a single 
keystroke, but i can not get it done. I use 'thread' to run this process 
in the background waiting for a keystroke. I don't want to use tkinter, 
widgets or pygame because those require a popup surface to work in and i 
already have the gnuplot window.

I tried a C like getch() function, but that pauses the code waiting for 
key press instead of scanning the event queue.

Is there any other means for general event handling in Python?

Any help would be greatly appreciated.


Sincerely,
Peter




More information about the Python-list mailing list