Method summary
Methods
- __init__(self, key, *modifiers)
Creates this key spec with the given modifiers.
- match(self, event)
Returns True if the given Enable key_pressed event matches this key specification.
API Reference for Enthought Tool Suite 3.2.0
Creates a key specification to facilitate tools interacting with the keyboard. A tool can declare either a class attribute:
magic_key = KeySpec("Right", "control")
or a trait:
magic_key = Instance(KeySpec, args=("Right", "control"))
and then check to see if the key was pressed by calling:
if self.magic_key.match(event):
# do stuff...
The names of the keys come from Enable, so both examples above are specifying the user pressing Ctrl + Right_arrow.
Creates this key spec with the given modifiers.
Returns True if the given Enable key_pressed event matches this key specification.
© Copyright 2002-2009 Enthought, Inc.