Mention index, get and the fact that all but ALPHA keys are case-sensitive to docs

This commit is contained in:
John Morrison 2022-04-25 17:51:00 +01:00 committed by xs5871
parent 7d46e701aa
commit 8950e45325

View File

@ -166,3 +166,18 @@ have my handlers attached:
```python ```python
SHREKLESS_ALT = KC.LALT.clone() SHREKLESS_ALT = KC.LALT.clone()
``` ```
You can also refer to a key by index:
* KC['A']
* KC['NO']
* KC['LALT']
or the get function which has an optional argument of `default`. `default` is
be returned if the key is not found (`None` unless otherwise specified):
* KC.get('A')
* KC.get('NO', None)
* KC.get('NOT DEFINED', KC.RALT)
Keys names are case-sensitive. KC['NO'] being different from KC['no']. It is recommended
that names are capitalised typically. The exception to this is alphabetical; KC['A'] and
KC['a'] will both return the same, unshifted, key.