MCPcopy Create free account
hub / github.com/geekcomputers/Python / on_press

Function on_press

JARVIS/JARVIS_2.0.py:154–164  ·  view source on GitHub ↗
(key)

Source from the content-addressed store, hash-verified

152
153
154def on_press(key):
155 if key == keyboard.Key.esc:
156 return False # stop listener
157 try:
158 k = key.char # single-char keys
159 except:
160 k = key.name # other keys
161 if k in ["1", "2", "left", "right"]: # keys of interest
162 # self.keys.append(k) # store it in global-like variable
163 print("Key pressed: " + k)
164 return False # stop listener; remove this if want more keys
165
166
167# Run Application with Voice Command Function

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected