[pygtk] Special Keys for Accelerators

Neil Muller drnlmuller+gtk at gmail.com
Sun Mar 29 14:02:47 WST 2009


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

-- 
Neil Muller
drnlmuller at gmail.com

I've got a gmail account. Why haven't I become cool?


More information about the pygtk mailing list