API Reference for Enthought Tool Suite 3.2.0
ASCII_CONTROL_KEYS = { Const(8) : Const('Backspace'), Const(9) : Const('Tab'), Const(13) : Const('Enter'), Const(27) : Const('Esc') }
BUTTON_NAME_MAP = { Getattr(Name('mouse'), 'LEFT') : Const('Left'), Getattr(Name('mouse'), 'RIGHT') : Const('Right'), Getattr(Name('mouse'), 'MIDDLE') : Const('Middle') }
KEY_MAP = { Getattr(Name('key'), 'BACKSPACE') : Const('Backspace'), Getattr(Name('key'), 'TAB') : Const('Tab'), Getattr(Name('key'), 'RETURN') : Const('Enter'), Getattr(Name('key'), 'ESCAPE') : Const('Esc'), Getattr(Name('key'), 'DELETE') : Const('Delete'), Getattr(Name('key'), 'ENTER') : Const('Enter'), Getattr(Name('key'), 'PAUSE') : Const('Pause'), Getattr(Name('key'), 'NUMLOCK') : Const('Num Lock'), Getattr(Name('key'), 'SCROLLLOCK') : Const('Scroll Lock'), Getattr(Name('key'), 'MINUS') : Const('Subtract'), Getattr(Name('key'), 'LEFT') : Const('Left'), Getattr(Name('key'), 'RIGHT') : Const('Right'), Getattr(Name('key'), 'UP') : Const('Up'), Getattr(Name('key'), 'DOWN') : Const('Down'), Getattr(Name('key'), 'HOME') : Const('Home'), Getattr(Name('key'), 'END') : Const('End'), Getattr(Name('key'), 'PAGEUP') : Const('Page Up'), Getattr(Name('key'), 'PAGEDOWN') : Const('Page Down'), Getattr(Name('key'), 'EXECUTE') : Const('Execute'), Getattr(Name('key'), 'PRINT') : Const('Print'), Getattr(Name('key'), 'SELECT') : Const('Select'), Getattr(Name('key'), 'INSERT') : Const('Insert'), Getattr(Name('key'), 'CANCEL') : Const('Cancel'), Getattr(Name('key'), 'BREAK') : Const('Break'), Getattr(Name('key'), 'HELP') : Const('Help'), Getattr(Name('key'), 'NUM_0') : Const('Numpad 0'), Getattr(Name('key'), 'NUM_1') : Const('Numpad 1'), Getattr(Name('key'), 'NUM_2') : Const('Numpad 2'), Getattr(Name('key'), 'NUM_3') : Const('Numpad 3'), Getattr(Name('key'), 'NUM_4') : Const('Numpad 4'), Getattr(Name('key'), 'NUM_5') : Const('Numpad 5'), Getattr(Name('key'), 'NUM_6') : Const('Numpad 6'), Getattr(Name('key'), 'NUM_7') : Const('Numpad 7'), Getattr(Name('key'), 'NUM_8') : Const('Numpad 8'), Getattr(Name('key'), 'NUM_9') : Const('Numpad 9'), Getattr(Name('key'), 'NUM_DOWN') : Const('Down'), Getattr(Name('key'), 'NUM_UP') : Const('Up'), Getattr(Name('key'), 'NUM_LEFT') : Const('Left'), Getattr(Name('key'), 'NUM_RIGHT') : Const('Right'), Getattr(Name('key'), 'NUM_HOME') : Const('Home'), Getattr(Name('key'), 'NUM_END') : Const('End'), Getattr(Name('key'), 'NUM_PAGE_UP') : Const('Page Up'), Getattr(Name('key'), 'NUM_PAGE_DOWN') : Const('Page Down'), Getattr(Name('key'), 'NUM_ENTER') : Const('Enter'), Getattr(Name('key'), 'NUM_INSERT') : Const('Insert'), Getattr(Name('key'), 'NUM_DELETE') : Const('Delete'), Getattr(Name('key'), 'NUM_DECIMAL') : Const('.'), Getattr(Name('key'), 'NUM_ADD') : Const('+'), Getattr(Name('key'), 'NUM_MULTIPLY') : Const('*'), Getattr(Name('key'), 'NUM_SUBTRACT') : Const('-'), Getattr(Name('key'), 'NUM_DIVIDE') : Const('/'), Getattr(Name('key'), 'LSHIFT') : Const('Shift'), Getattr(Name('key'), 'RSHIFT') : Const('Shift'), Getattr(Name('key'), 'LCTRL') : Const('Control'), Getattr(Name('key'), 'RCTRL') : Const('Control'), Getattr(Name('key'), 'LMETA') : Const('Meta'), Getattr(Name('key'), 'RMETA') : Const('Meta'), Getattr(Name('key'), 'LALT') : Const('Alt'), Getattr(Name('key'), 'RALT') : Const('Alt'), Getattr(Name('key'), 'LWINDOWS') : Const('Windows'), Getattr(Name('key'), 'RWINDOWS') : Const('Windows'), Getattr(Name('key'), 'LCOMMAND') : Const('Command'), Getattr(Name('key'), 'RCOMMAND') : Const('Command'), Getattr(Name('key'), 'LOPTION') : Const('Option'), Getattr(Name('key'), 'ROPTION') : Const('Option'), Getattr(Name('key'), 'F1') : Const('F1'), Getattr(Name('key'), 'F2') : Const('F2'), Getattr(Name('key'), 'F3') : Const('F3'), Getattr(Name('key'), 'F4') : Const('F4'), Getattr(Name('key'), 'F5') : Const('F5'), Getattr(Name('key'), 'F6') : Const('F6'), Getattr(Name('key'), 'F7') : Const('F7'), Getattr(Name('key'), 'F8') : Const('F8'), Getattr(Name('key'), 'F9') : Const('F9'), Getattr(Name('key'), 'F10') : Const('F10'), Getattr(Name('key'), 'F11') : Const('F11'), Getattr(Name('key'), 'F12') : Const('F12'), Getattr(Name('key'), 'F13') : Const('F13'), Getattr(Name('key'), 'F14') : Const('F14'), Getattr(Name('key'), 'F15') : Const('F15'), Getattr(Name('key'), 'F16') : Const('F16') }
POINTER_MAP = { Const('arrow') : Getattr(Name('win'), 'CURSOR_DEFAULT'), Const('arrow wait') : Getattr(Name('win'), 'CURSOR_WAIT'), Const('char') : Getattr(Name('win'), 'CURSOR_TEXT'), Const('cross') : Getattr(Name('win'), 'CURSOR_CROSSHAIR'), Const('hand') : Getattr(Name('win'), 'CURSOR_HAND'), Const('ibeam') : Getattr(Name('win'), 'CURSOR_TEXT'), Const('no entry') : Getattr(Name('win'), 'CURSOR_NO'), Const('question arrow') : Getattr(Name('win'), 'CURSOR_HELP'), Const('size top') : Getattr(Name('win'), 'CURSOR_SIZE_DOWN'), Const('size bottom') : Getattr(Name('win'), 'CURSOR_SIZE_UP'), Const('size left') : Getattr(Name('win'), 'CURSOR_SIZE_RIGHT'), Const('size right') : Getattr(Name('win'), 'CURSOR_SIZE_LEFT'), Const('size top right') : Getattr(Name('win'), 'CURSOR_SIZE_DOWN'), Const('size bottom left') : Getattr(Name('win'), 'CURSOR_SIZE_DOWN'), Const('size top left') : Getattr(Name('win'), 'CURSOR_SIZE_DOWN'), Const('size bottom right') : Getattr(Name('win'), 'CURSOR_SIZE_DOWN'), Const('sizing') : Getattr(Name('win'), 'CURSOR_SIZE'), Const('wait') : Getattr(Name('win'), 'CURSOR_WAIT'), Const('watch') : Getattr(Name('win'), 'CURSOR_WAIT'), Const('arrow wait') : Getattr(Name('win'), 'CURSOR_WAIT_ARROW'), Const('bullseye') : Getattr(Name('win'), 'CURSOR_DEFAULT'), Const('left button') : Getattr(Name('win'), 'CURSOR_DEFAULT'), Const('middle button') : Getattr(Name('win'), 'CURSOR_DEFAULT'), Const('right button') : Getattr(Name('win'), 'CURSOR_DEFAULT'), Const('magnifier') : Getattr(Name('win'), 'CURSOR_DEFAULT'), Const('paint brush') : Getattr(Name('win'), 'CURSOR_DEFAULT'), Const('pencil') : Getattr(Name('win'), 'CURSOR_DEFAULT'), Const('point left') : Getattr(Name('win'), 'CURSOR_DEFAULT'), Const('point right') : Getattr(Name('win'), 'CURSOR_DEFAULT'), Const('spray can') : Getattr(Name('win'), 'CURSOR_DEFAULT') }
Since Pyglet has both on_key_press and on_text events, and it's not entirely clear if certain keys generate both events, we maintain an empirical list of keys in the KEY_MAP that also generate on_text events. (Generally, entries in the KEY_MAP are used to map unprintable or control characters, so by default we would expect them not to generate on_text events.)
TEXT_KEYS = (key.RETURN, key.ENTER, key.NUM_0, key.NUM_1, key.NUM_2, key.NUM_3, key.NUM_4, key.NUM_5, key.NUM_6, key.NUM_7, key.NUM_8, key.NUM_9, key.NUM_DECIMAL, key.NUM_ADD, key.NUM_MULTIPLY, key.NUM_SUBTRACT, key.NUM_DIVIDE)
| Local name | Refers to |
|---|---|
| key | pyglet.window.key |
| mouse | pyglet.window.mouse |
| win | pyglet.window.BaseWindow |
© Copyright 2002-2009 Enthought, Inc.