KeyCapture

from acron.input_map import KeyCapture
class KeyCapture(base, on_key, *, cancel=('escape',), ignore=frozenset({'wheel_down', 'wheel_left', 'wheel_right', 'wheel_up'}))

Bases: DirectObject

The next button pressed, whatever it is – a rebinding screen’s ear.

on_key(name) fires once, with Acron’s own button name ("g", "mouse1", "arrow_up", "lshift"), and the capture is over; on_key(None) when a cancel key was pressed instead. While it listens, every other listener still hears its own events – the screen behind it decides what to ignore.

The window’s first ButtonThrower reports every press through its general button-down event while the capture is on; a base with no throwers (an offscreen buffer) is fine, and a test presses keys with messenger.send(KeyCapture.EVENT, [name]).

Inheritance diagram

digraph inheritance03276b1ea3 { bgcolor=transparent; rankdir=BT; size="8.0, 12.0"; "DirectObject" [URL="direct.showbase.DirectObject.html#direct.showbase.DirectObject.DirectObject",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="This is the class that all Direct/SAL classes should inherit from"]; "KeyCapture" [URL="acron.input_map.KeyCapture.html#acron.input_map.KeyCapture",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="The next button pressed, whatever it is -- a rebinding screen's ear."]; "DirectObject" -> "KeyCapture" [arrowsize=0.75,style=""]; }
EVENT = 'acron-key-capture'