Appearance
key
The supported key codes are:
- Letters:
a–z(case-insensitive) - Digits:
0–9 - Function keys:
F1–F12 - Modifiers:
Shift,Control,Alt,Meta - Editing:
Enter,Backspace,Tab,Space(also accepts" ") - Navigation:
ArrowUp,ArrowDown,ArrowLeft,ArrowRight,Escape - iOS buttons:
Home,Power,volume+,volume- - Symbols:
-,=,[,],\,;,',`,,,.,/and their shifted forms
Unknown key codes raise ValueError.
TIP
key.click() automatically handles uppercase letters and shifted symbols. For key.down() / key.up(), hold Shift explicitly.
key.click()
Press and release a key.
python
key.click(code: str) -> NoneArguments
| Name | Type | Default | Description |
|---|---|---|---|
| code | str | The key code. |
Return
None.
Example
python
from catscript import key
if __name__ == "__main__":
key.click("Home")key.down()
Press and hold a key.
python
key.down(code: str) -> NoneArguments
| Name | Type | Default | Description |
|---|---|---|---|
| code | str | The key code. |
Return
None.
Example
python
import time
from catscript import key
if __name__ == "__main__":
key.down("Home")
time.sleep(0.1)
key.up("Home")key.up()
Release a key.
python
key.up(code: str) -> NoneArguments
| Name | Type | Default | Description |
|---|---|---|---|
| code | str | The key code. |
Return
None.
Example
python
import time
from catscript import key
if __name__ == "__main__":
key.down("Home")
time.sleep(0.1)
key.up("Home")