🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

pylayout

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pylayout

Module to get and set keyboard layout

pipPyPI
Version
0.1.2
Maintainers
1

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

Keywords

keyboard

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts