[pygtk] Special Keys for Accelerators

JSeipp jseipp at web.de
Sun Mar 29 20:22:47 WST 2009


Thank you very much! It works perfectly.

Cheers,
Jendrik


Neil Muller schrieb:
> On Sun, Mar 29, 2009 at 3:01 AM, JSeipp <jseipp at web.de> wrote:
>   
>> Hello,
>> i have searched everywhere but couldn't find a solution to this:
>>
>> How do I assign an accelerator to a special key combination like "Ctrl"
>> + "Page-Up" ?
>>
>> Widget.add_accelerator('clicked', self.accel_group, ord('U'),
>> gtk.gdk.CONTROL_MASK, gtk.ACCEL_VISIBLE)  works for single letters like
>> "U", but how can I get the keyval for "Page-Up". Any ideas?
>>     
>
> You can lookup the keyval using gtk.gdk.keyval_from_name.
>
> I would use gtk.accelerator_parse here, though, as I find something like:
>
> (key_val, mod) = gtk.accelerator_parse('<Ctrl>Page_Up')
> Widget.add_accelerator('clicked', self.accel_group, key_val, mod,
> gtk.ACCEL_VISIBLE)
>
> easier to read later
>
>   


More information about the pygtk mailing list