On 8/22/07, <b class="gmail_sendername">Julius B. Lucks
</b> <<a href="mailto:julius@younglucks.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">julius@younglucks.com</a>> wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
Hi Erik,<div><br></div><div>In pygame, we are using the keys</div><div><br></div><div>pygame.K_KP9, #KP_Page_Up</div><div>pygame.K_KP3, #KP_Page_Down</div><div>pygame.K_KP1, #KP_End</div><div>pygame.K_KP7, #KP_Home</div>
<div><br></div><div>which (I believe) correspond to</div><div><br></div><div>pygame.K_UP,</div><div>pygame.K_DOWN,</div><div>pygame.K_RIGHT,</div><div>pygame.K_LEFT,</div><div><br></div><div>I would assume the constants are similarly named for gtk. Hope this helps,
</div><div><br></div><div>Julius</div></div></blockquote><div><br><br>Thanks for your suggestion Julius. I've modified my code:<br><br><span style="font-family: courier new,monospace;">
def _keyPressEventCb( self, widget, event ):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
keyname = gtk.gdk.keyval_name(event.keyval)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
print( "keyname:", keyname )</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
#check: KP_End</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
if (keyname == 'KP_Page_Up'):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
print("gamekey O")</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
elif (keyname == 'KP_Page_Down'):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
print("gamekey X")</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
elif (keyname == 'KP_End'):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
print("gamekey CHECK")</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
elif (keyname == 'KP_Home'):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
print("gamekey SQUARE")</span><br><span class="gmail_quote"></span><br>The maddening part is that sometimes I launch a sugar activity and this works: keyname is equal to 'KP_Page_Down', etc.
<br><br>But sometimes it doesn't work and Ikeyname is <span style="font-weight: bold;"><span style="font-family: courier new,monospace;"><span style="font-weight: bold;"></span>^[[4~</span></span>, etc. instead. <br>
<br>To whom do I file this in trac?<br></div><br></div><br>