>perhaps you need tab and not up arrow
I'm actually using Left and Right. When I set a hw code in addition to the
keyval, it works fine.
what I'm doing (to give you a better idea of what's happening):
def spoof_key_press(self, keyval, hardware_keycode):
print "Soofing: %d" % keyval
if self.main_window != None:
e = gtk.gdk.Event(gtk.gdk.KEY_PRESS)
e.state = 0
e.keyval = keyval
e.hardware_keycode = hardware_keycode
e.window = self.main_window.window
e.time = 0
self.main_window.emit("key-press-event", e)
Then I call it like:
main_controller.spoof_key_press(gtk.keysyms.Right, 102)
I don't have any connections defined to handle the key-press-event or anything,
I want the system to handle it on its own. In this example, I've got
main_controller which contains a reference to my window (main_window).
main_window has several layout boxes in it to lay out the widgets; namely an
HBox containing a row of buttons, then an EventBox which I'm using as a dynamic
region, like (gets updated with different contents depending on what's going
on... it's got a plugin-system to define this stuff).
so, I want to be able to move the focus left and right in the HBox (spoofing
the key-press-events to the HBox and its children), but then I'd like the
ability to switch and send the spoofed key-press-events to the EventBox (which
will trickle down to its children, or whatever) and have the plugin handle the
events.
this is strictly for when I control everything with the joystick. it's not
really necessary when the user has keyboard/mouse control since they'll have a
lot more control over the behavior, anyway.
is this possible? (sorry for this overly-long explanation. maybe I'm just going
about this all wrong)
thanks!
...spike
>> also, is there any way of specifying where in the widget hierarchy to start
>> the key-pressed-event? I'd rather have some control over where the spoofed
>> keypresses go so I can possibly do some filtering of them.
>not sure what u mean, but in most cases it's from inside to outside
>and with keypress this is the thing
...spike
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/