Module to get and set keyboard layout
Project description
pylayout
pylayout
is a Python module for getting and setting the current keyboard layout in Windows. It also includes utilities for detecting the language of input characters and translating text between keyboard layouts.
It supports Windows and linux systems.
Installation
pip install pylayout
Usage
from pylayout import Layout
layout = Layout(use_cache=False) # use_cache=True reduces calls to the system to acquire list of available layouts speeding up module
print("Current layout:", layout.get())
print("Available layouts:", layout.list())
layout.set("uk") # Set layout to Ukrainian
print("New layout:", layout.get())
# Currently translate and detect_language support only us and uk languages. Can be extended by modifying LAYOUTS dict
char = "ї"
print(f"Language for '{char}':", layout.detect_language(char))
print("Translate 'ghbdsn' from 'en' to 'uk':", layout.translate("ghbdsn", "en", "uk"))
Features
- Get the current keyboard layout
- Set the keyboard layout by language code (e.g.,
en
,uk
) - List all available keyboard layouts
- Detect the language associated with a given character
- Translate text from one keyboard layout to another (e.g., fix "ghbdsn" typed in the wrong layout)
Fixes
There are some issues on windows so here are some resources to fix them
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pylayout-0.1.2.tar.gz
(8.3 kB
view details)
Built Distribution
File details
Details for the file pylayout-0.1.2.tar.gz
.
File metadata
- Download URL: pylayout-0.1.2.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
f26be7183ecc327509b09379489ab7bf3bf30d29bde0c9f982b1398555432c0e
|
|
MD5 |
5a8e4416a60bafafcb2b174d05e51cb6
|
|
BLAKE2b-256 |
d1cb206406769ff55857412bf98cb0091172e29d96679d911a06cc7d7f65d966
|
File details
Details for the file pylayout-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: pylayout-0.1.2-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
8d2a1d26dc4077460fb79eea0547328642ae26bb736942f72a5fce842f06dd25
|
|
MD5 |
d839c8ee5d02cb1c84e172a0ff947808
|
|
BLAKE2b-256 |
e2b8599bc60bc0983f29e25685f8289f5bfc5a63dcbaec2810b9e7d34a597cc3
|