ソースコードの中を掘った後、それが見えます。
def record(until='escape'):
"""
Records all keyboard events from all keyboards until the user presses the
given key combination. Then returns the list of events recorded, of type
`keyboard.KeyboardEvent`. Pairs well with
`play(events)`.
Note: this is a blocking function.
Note: for more details on the keyboard hook and events see `hook`.
"""
recorded = []
hook(recorded.append)
wait(until)
unhook(recorded.append)
return recorded
パラメータuntil
はwait()
に渡されます。したがって、wait()
には、任意のキープレスを処理するコードが必要です。
def wait(combination=None):
"""
Blocks the program execution until the given key combination is pressed or,
if given no parameters, blocks forever.
"""
wait, unlock = _make_wait_and_unlock()
if combination is not None:
hotkey_handler = add_hotkey(combination, unlock)
wait()
remove_hotkey(hotkey_handler)
最終的には、そこにkeyboard.record(until='any')
のようなものを処理するために構築された全くのソースコードはありませんので、あなたは、回避策を見つける必要があります。 How do I make python to wait for a pressed keyを確認してください。
出典
2017-08-30 18:30:37
Aor
私がどのkeypressでもロガーを止めるには、なぜ1位にしたいのか分かりません。 Btwでは、モジュールによって生成されたイベントタイプは_key down_と_key up_です。また、質問にもエラーが含まれている必要があります。 – CristiFati