tis 2004-06-01 klockan 20.45 skrev [EMAIL PROTECTED]:
> How do I remove the binding of say, the RETURN key on a button widget?
> I spent some time googline for "keyboard shortcut" but didn't find
> anything useful.  Searching for "keyboard accelerator" yielded lots of
> chit-chat about menus.  I would like to make it so the only way to
> activate selected buttons (generally those with potentially disastrous
> actions) is by clicking with the mouse.  (Actually, I have users who
> seem to lean on their keyboards at inopportune times.  They want
> keyboard shortcuts disabled.)

Override key-press-event for the specific widget and return True when
you'd like the event to be skipped, something like this should do:

def key_press_event_cb(button, event):
  if event.keyval == keysyms.Return:
     return True
button.connect('key-press-event', key_press_event_cb)

Remember to filter out space too.

-- 
Johan Dahlin <[EMAIL PROTECTED]>

_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to