Finds the closest neighboring keys of a given letter on a specific keyboard layout
pip install surroundingkeys
Tested against Windows 10 / Python 3.10 / Anaconda
A utility function to find the closest neighboring keys of a given letter on a specific keyboard layout.
Parameters:
-----------
letter : str
The letter for which to find the neighboring keys.
keyboard : str
The keyboard layout identifier. Should be one of the identifiers shown when you call show_all_keyboards().
Returns:
--------
dict
A dictionary containing the neighboring keys of the input letter on the specified keyboard layout.
The dictionary has the following structure:
{
input_letter: {
'side': [list of letters on the left and right sides],
'top': [list of letters above the input letter],
'bottom': [list of letters below the input letter]
}
}
If no neighboring keys are found or the input letter is not available on the specified keyboard layout,
the corresponding list will be empty.
Example:
--------
from surroundingkeys import get_next_letters, show_all_keyboards
for letter in 'Oi, tudo bem?':
result = get_next_letters(letter=letter, keyboard="kbdbr_1")
print(result)
print(letter)
{'O': {'side': ['I', 'P'], 'top': ['9', '0'], 'bottom': ['K', 'L']}}
O
{'i': {'side': ['u', 'o'], 'top': ['8', '9'], 'bottom': ['j', 'k']}}
i
{',': {'side': ['m', '.'], 'top': ['k', 'l'], 'bottom': []}}
,
{' ': {'side': [], 'top': [], 'bottom': []}}
{'t': {'side': ['r', 'y'], 'top': ['5', '6'], 'bottom': ['f', 'g']}}
t
{'u': {'side': ['y', 'i'], 'top': ['7', '8'], 'bottom': ['h', 'j']}}
u
{'d': {'side': ['s', 'f'], 'top': ['e', 'r'], 'bottom': ['x', 'c']}}
d
{'o': {'side': ['i', 'p'], 'top': ['9', '0'], 'bottom': ['k', 'l']}}
o
{' ': {'side': [], 'top': [], 'bottom': []}}
{'b': {'side': ['v', 'n'], 'top': ['g', 'h'], 'bottom': []}}
b
{'e': {'side': ['w', 'r'], 'top': ['3', '4'], 'bottom': ['s', 'd']}}
e
{'m': {'side': ['n', ','], 'top': ['j', 'k'], 'bottom': []}}
m
{'?': {'side': [], 'top': [], 'bottom': []}}
?
Note:
-----
This function uses a cache (LRU cache) to speed up repeated calls with the same inputs.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
surroundingkeys-0.10.tar.gz
(73.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file surroundingkeys-0.10.tar.gz.
File metadata
- Download URL: surroundingkeys-0.10.tar.gz
- Upload date:
- Size: 73.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/4.0.2 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6de72bfd273fd077acb7da212e8628f17b096ae482d6dcdc253c779c3c986fab
|
|
| MD5 |
d2b623f5cadede5f2e5725cdc3570194
|
|
| BLAKE2b-256 |
8db86242f1e70160f5da601b2dc8ca178077cf8b530bebe20fb695dada6a5234
|
File details
Details for the file surroundingkeys-0.10-py3-none-any.whl.
File metadata
- Download URL: surroundingkeys-0.10-py3-none-any.whl
- Upload date:
- Size: 381.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/4.0.2 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0f74669074ce28ce4164681b18947aba94d16a2229cc26466efbf0f85470389
|
|
| MD5 |
d0b804ce9daf2ee9069c9bf6617cc6ea
|
|
| BLAKE2b-256 |
7331a45b838522d2215cd8c481b32535f9be22dfbb5d32f050de183c0dc2a71a
|