From: Tim L. <ti...@cs...> - 2005-04-13 09:32:56
|
Hi all, I'm developing an app where i'd like the user to be able to navigate using the up/down/left/right keys. Currently the mpl event handlers just return None for these, but I figured it'd be easy enough to add the code myself. in lib/matplotlib/backends/backend_gtk.py I added the following diff, which adds in some new code -> string mappings and also notifies me when a key press or key release is made (for debugging). 109,112d108 < 65361 : 'left', < 65362 : 'up', < 65363 : 'right', < 65364 : 'down', 176c172 < --- > 184d179 < print "hit", key 189d183 < print "release", key This all works fine except that the down key doesn't register as released. After registering the down key press, no other key events register until you hit the up key, at which point the key release triggers for the up. If i hit the following sequence: [up, left, right, down, <any sequence not including up or down>, up, up] I get the following events registering. hit up release up hit left release left hit right release right hit down <== we never get the matching "release down" or anything else release up <== until we hit the up key and get this release event for it hit up release up I really don't know a lot about Gtk or the matplotlib internals so I couldn't trace this bug deeper into the libraries. Can anyone shed some light on what's going on? If we can get the arrow keys working is there a chance of getting them into the standard distribution (assuming we had all backends working)? Cheers, Tim Leslie |