Class pyglet.window.key.KeyStateHandler

dict --+
       |
      KeyStateHandler

Simple handler that tracks the state of keys on the keyboard. If a key is pressed then this handler holds a True value for it.

For example:

>>> win = window.Window
>>> keyboard = key.KeyStateHandler()
>>> win.push_handlers(keyboard)

# Hold down the "up" arrow...

>>> keyboard[key.UP]
True
>>> keyboard[key.DOWN]
False

Methods

  on_key_press(self, symbol, modifiers)
  on_key_release(self, symbol, modifiers)
  __getitem__(self, key)
x[y]
Inherited from dict: __cmp__, __contains__, __delitem__, __eq__, __ge__, __getattribute__, __gt__, __init__, __iter__, __le__, __len__, __lt__, __ne__, __new__, __repr__, __setitem__, __sizeof__, clear, copy, fromkeys, get, has_key, items, iteritems, iterkeys, itervalues, keys, pop, popitem, setdefault, update, values

Class Variables

Inherited from dict: __hash__

Method Details

__getitem__

(Indexing operator) __getitem__(self, key)
x[y]
Overrides:
dict.__getitem__