A python library to display different keyboards
Project description
keyboardlayout
A python library to display different keyboards. Works with pygame or tkinter.
If you need to show your users a graphic that shows a specific keyboard layout or a portion of a keyboard, this is the library for you.
Features:
- shows a keyboard to the user
- keyboard layouts
- qwerty
- azerty laptop
- graphics backends
- pygame (uses sprite groups)
- tkinter (uses frames + labels)
- customize the keyboard with sizes, colors, key margin, padding, font, location, etc
- update a specific key with
update_key
- can update key images when keys are pressed
Changelog
https://github.com/spacether/keyboardlayout/tree/master/CHANGELOG.md
Documentation
https://spacether.github.io/keyboardlayout/
Examples
qwerty with colors
qwerty
azerty laptop
Installation
Make sure that you are using Python3
pip install keyboardlayout
Samples
Usage
tkinter example
import tkinter as tk
import tkinter.font as tkf
import keyboardlayout as kl
import keyboardlayout.tkinter as klt
layout_name = kl.LayoutName.QWERTY
key_size = 60
grey = '#bebebe'
dark_grey = '#414141'
keyboard_info = kl.KeyboardInfo(
position=(0, 0),
padding=2,
color=dark_grey
)
window = tk.Tk()
window.resizable(False, False)
key_info = kl.KeyInfo(
margin=10,
color=grey,
txt_color=dark_grey,
txt_font=tkf.Font(family='Arial', size=key_size//4),
txt_padding=(key_size//6, key_size//10)
)
letter_key_size = (key_size, key_size) # width, height
keyboard_layout = klt.KeyboardLayout(
layout_name,
keyboard_info,
letter_key_size,
key_info,
master=window
)
window.mainloop()
Local Installation
# make and activate virtual env
python3 -m venv venv
source venv/bin/activate
# if you want to edit the program and have the library use your edits
make develop
# to install separately in your virtual environment
make install
Test
make test
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
keyboardlayout-2.0.0.tar.gz
(13.8 kB
view details)
Built Distribution
File details
Details for the file keyboardlayout-2.0.0.tar.gz
.
File metadata
- Download URL: keyboardlayout-2.0.0.tar.gz
- Upload date:
- Size: 13.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a244322d3e43837b5ef175e30ebcc8c133b833eab6aeca36af07c03f48c5ea41 |
|
MD5 | be9ad932fb50db00d2c9ead711c2599a |
|
BLAKE2b-256 | 0f06697a1a16ac4ab024c2780ec6a24ae2c66d59db74a63a44e575420479e3b0 |
File details
Details for the file keyboardlayout-2.0.0-py3-none-any.whl
.
File metadata
- Download URL: keyboardlayout-2.0.0-py3-none-any.whl
- Upload date:
- Size: 16.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fd3e00708724228e303c66a458cd7bdaa8a8ecc888cf4b5cad0c49ca4ab696d |
|
MD5 | be741e99ea8c00d9f14fd2eaeae76440 |
|
BLAKE2b-256 | af611cb000f13e6ce5fada162c153e3a199c03e8cb8c996c4586280ecf4c36de |