title: Using callback function in pyevent
body: <p>I want to detect pressing the "snapshot" button on the top of a webcam in linux. The button has this entry in /dev:
     /dev/input/by-id/usb-PixArt_Imaging_Inc._USB2.0_UVC_VGA-event-if00</p>
  
  <p>I am using the "rel" wrapper, at the moment, because it handles exceptions better. Before the following code executes, self.s.cam_btn is assigned the /dev entry for the button.</p>
  
  <pre><code>    rel.override()
      rel.init()
      rel.read(self.s.cam_btn, self.snap)
      rel.dispatch()
  </code></pre>
  
  <p>self.snap() is the callback. It captures a screen shot from mplayer and feeds the image to an OCR program. Everything mostly works until the callback returns. Here is the problem:</p>
  
  <p>If self.snap() returns nothing, the program stops and will not service any more button events. If self.snap() returns 1, the program continues servicing the same button event in an infinite loop, rather than waiting for a new event. Documentation for pyevent is a little sparse so any help gratefully received.</p>
  
  <p>Clinton</p>