| |
- Event(object)
-
- KeyboardEvent
- KeypressEvent
- EventManager(object)
-
- KeyboardEventManager
- KeypressEventManager
class KeyboardEvent(Event) |
|
Raw keyboard events, includes <ctrl> and the like.
Characters are reported as their un-modified equivalents,
so that 'A' represents both "a" and "A"
attributes:
type -- "keyboard"
renderingPass -- pointer to the OpenGLContext.renderpass.RenderPass
object associated with this event
modifiers -- three-tuple of booleans: (shift, control, alt)
name -- the "key name" see KeyboardEventManager.registerCallback
for discussion of possible values.
state -- Boolean 0 = up/released, 1 = down/pressed |
|
- Method resolution order:
- KeyboardEvent
- Event
- object
Methods defined here:
- getKey(self)
- Get the event key used to lookup a handler for this event
Data and other attributes defined here:
- name = ''
- side = 0
- state = 0
- type = 'keyboard'
Methods inherited from Event:
- __init__(self)
- Initialize common event parameters
- getModifiers(self)
- Retrieve a tuple of the active modifier keys
Format is three Boolean values, (shift, control, alt)
- visited(self, key, value=None)
- Check for or register visitation of the given key
key -- an opaque hashable value, normally the node and
field/event as a tuple.
value -- if provided, sets the current value, otherwise
signals that the current value should be returned
return value: previous key value (possibly None)
Data descriptors inherited from Event:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from Event:
- context = None
- modifiers = (0, 0, 0)
- renderingPass = None
|
class KeyboardEventManager(EventManager) |
|
Class responsible for registration, deregistration and processing
of keyboard-based events. Also can be used to track meta-key state |
|
- Method resolution order:
- KeyboardEventManager
- EventManager
- object
Methods defined here:
- registerCallback(self, name=None, state=0, modifiers=(0, 0, 0), function=None)
- Register a function to receive keyboard events matching
the given specification To deregister, pass None as the
function.
name -- string name for the key in which you are interested
if this is None, the entire key is None
and will be matched only after all other names fail.
Valid Values:
characters > 32 and < 256
'<return>', '<tab>'
'<insert>', '<delete>',
'<up>','<down>',
'<left>','<right>',
'<pageup>','<pagedown>',
'<home>','<end>',
'<escape>', '<start>',
'<numlock>', '<scroll>', '<capslock>',
'<F1>' to '<F12>', to '<F24>' on some platforms
'<shift>',
'<ctrl>',
'<alt>'
Note: the characters are reported as their "lowercase"
values, though the key might be known as "B" to the
underlying system.
Note: the names are always the "un-shifted" keys, that
is, on a US keyboard, you'll never get "&" as the event
name, you'll get "7" with the modifiers showing shift
as being down.
state -- key state (0 = up, 1 = down)
function -- function taking a single argument (a KeyboardEvent)
or None to deregister the callback.
returns the previous handler or None
Data and other attributes defined here:
- type = 'keyboard'
Methods inherited from EventManager:
- ProcessEvent(self, event)
- Dispatch an incoming event
The event must define the getKey() method.
The event must have an attribute "type" (though the current
implementation does not actually use this, the information
should be available in ambiguous circumstances).
- __init__(self)
- Initialise the event manager
Data descriptors inherited from EventManager:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class KeypressEvent(Event) |
|
Key "pressed" event, doesn't include control characters,
and should provide "processed" characters, so that, for
instance, <shift>-<capslock>-A gives "a", not "A". Note also
that these are "full-press" events, not up/down notifications
attributes:
type -- "keypress"
renderingPass -- pointer to the OpenGLContext.renderpass.RenderPass
object associated with this event
modifiers -- three-tuple of booleans: (shift, control, alt)
name -- the "key name" see KeypressEventManager.registerCallback
for discussion of possible values. |
|
- Method resolution order:
- KeypressEvent
- Event
- object
Methods defined here:
- getKey(self)
- Get the event key used to lookup a handler for this event
Data and other attributes defined here:
- name = ''
- repeating = 0
- side = 0
- type = 'keypress'
Methods inherited from Event:
- __init__(self)
- Initialize common event parameters
- getModifiers(self)
- Retrieve a tuple of the active modifier keys
Format is three Boolean values, (shift, control, alt)
- visited(self, key, value=None)
- Check for or register visitation of the given key
key -- an opaque hashable value, normally the node and
field/event as a tuple.
value -- if provided, sets the current value, otherwise
signals that the current value should be returned
return value: previous key value (possibly None)
Data descriptors inherited from Event:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from Event:
- context = None
- modifiers = (0, 0, 0)
- renderingPass = None
|
class KeypressEventManager(EventManager) |
| |
- Method resolution order:
- KeypressEventManager
- EventManager
- object
Methods defined here:
- registerCallback(self, name=None, modifiers=(0, 0, 0), function=None)
- Register a function to receive keyboard events matching
the given specification To deregister, pass None as the
function.
name -- string name for the key in which you are interested
if this is None, the entire key is None
and will be matched only after all other names fail.
Valid Values:
characters > 32 and < 256
'<return>', '<tab>'
'<insert>', '<delete>',
'<up>','<down>',
'<left>','<right>',
'<pageup>','<pagedown>',
'<home>','<end>',
'<escape>',
'<F1>' to '<F12>', to '<F24>' on some platforms
Note: Attempts will be made to convert the character
to the "real" character typed (i.e. if shift is down
you should get 'F' instead of 'f' unless caps-lock is
also down). This is going to be fragile because it
may require trying to figure it out just from the
modifier states, and that won't work across keyboard
types.
modifiers -- (shift, control, alt) as a tuple of booleans.
function -- function taking a single argument (a KeypressEvent)
or None to deregister the callback.
returns the previous handler or None
Data and other attributes defined here:
- type = 'keypress'
Methods inherited from EventManager:
- ProcessEvent(self, event)
- Dispatch an incoming event
The event must define the getKey() method.
The event must have an attribute "type" (though the current
implementation does not actually use this, the information
should be available in ambiguous circumstances).
- __init__(self)
- Initialise the event manager
Data descriptors inherited from EventManager:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
| |