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__, __hash__, __init__, __iter__, __le__, __len__, __lt__, __ne__, __new__, __repr__, __setitem__, clear, copy, fromkeys, get, has_key, items, iteritems, iterkeys, itervalues, keys, pop, popitem, setdefault, update, values

Method Details

__getitem__

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