Package tdl :: Module event :: Class KeyEvent
[frames] | no frames]

Class KeyEvent

source code

object --+    
         |    
     Event --+
             |
            KeyEvent
Known Subclasses:

Instance Methods
 
__init__(self, key, char, lalt, lctrl, ralt, rctrl, shift)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
__repr__(self)
List an events public attributes when printed. (Inherited from tdl.event.Event)
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables
  type = None
String constant representing the type of event. (Inherited from tdl.event.Event)
Instance Variables
string key
Human readable names of the key pressed.
string char
A single character string of the letter or symbol pressed.
  keychar
Similar to key but returns a case sensitive letter or symbol instead of 'CHAR'.
boolean leftAlt
boolean rightAlt
boolean leftCtrl
boolean rightCtrl
boolean shift
True if shift was held down during this event.
boolean alt
True if alt was held down during this event.
boolean control
True if control was held down during this event.
Properties

Inherited from object: __class__

Method Details

__init__(self, key, char, lalt, lctrl, ralt, rctrl, shift)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

Instance Variable Details

key

Human readable names of the key pressed. Non special characters will show up as 'CHAR'.

Can be one of 'NONE', 'ESCAPE', 'BACKSPACE', 'TAB', 'ENTER', 'SHIFT', 'CONTROL', 'ALT', 'PAUSE', 'CAPSLOCK', 'PAGEUP', 'PAGEDOWN', 'END', 'HOME', 'UP', 'LEFT', 'RIGHT', 'DOWN', 'PRINTSCREEN', 'INSERT', 'DELETE', 'LWIN', 'RWIN', 'APPS', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'KP0', 'KP1', 'KP2', 'KP3', 'KP4', 'KP5', 'KP6', 'KP7', 'KP8', 'KP9', 'KPADD', 'KPSUB', 'KPDIV', 'KPMUL', 'KPDEC', 'KPENTER', 'F1', 'F2', 'F3', 'F4', 'F5', 'F6', 'F7', 'F8', 'F9', 'F10', 'F11', 'F12', 'NUMLOCK', 'SCROLLLOCK', 'SPACE', 'CHAR'

For the actual character instead of 'CHAR' use keychar.

Type:
string

char

A single character string of the letter or symbol pressed.

Special characters like delete and return are not cross-platform. key or keychar should be used instead for special keys. Characters are also case sensitive.

Type:
string

keychar

Similar to key but returns a case sensitive letter or symbol instead of 'CHAR'.

This variable makes available the widest variety of symbols and should be used for key-mappings or anywhere where a narrower sample of keys isn't needed.