Re: trouble with key bindings



Skip Montanaro <skip pobox com> writes: 
>     gobject.signal_new("move-obj", Sketch, gobject.SIGNAL_RUN_FIRST,

This needs to be SIGNAL_RUN_ACTION as well

>                        gobject.TYPE_NONE, (gobject.TYPE_INT, gobject.TYPE_INT))
> 
> I want to be able to bind <ctl>- and <shift>-prefixed arrow keys to the
> "move-obj" signal, so I defined the following

You have to do GtkBindingSet stuff, look at some example class_init
functions in GTK.
 
>     drw = Sketch()
>     drw.add_events(gtk.GDK.KEY_PRESS_MASK|gtk.GDK.KEY_RELEASE_MASK)
>     drw.set_flags(gtk.CAN_FOCUS)

Be sure you actually have focus when you're testing; maybe you want to
draw some indication on focus_in_event.

Havoc




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]