[Sugar-devel] ASCII keypresses

Art Hunkins abhunkin at uncg.edu
Mon Aug 15 18:23:07 EDT 2011


In a new activity I'm working on, I'm catching (and passing on) ASCII 
keypresses with the following Python snippet:

 def onKeyPress(self, widget, event):
   if self.p:
     self.w.set_channel("ascii", event.keyval)

 def playcsd(self, widget):
   if self.p == False:
     self.p = True
     self.w.play()
     self.but.child.set_label("STOP !")
     self.connect("key-press-event", self.onKeyPress)


Basically the code works; I need, however, for the keypress to be passed on 
*for a single cycle only*, and for the routine also to accommodate repeat 
keypresses.

Thanks for some help with this.

Art Hunkins 



More information about the Sugar-devel mailing list