Metadata-Version: 2.1
Name: keyboardlayout
Version: 1.0.0
Summary: A python library to display different keyboards
Home-page: https://github.com/spacether/keyboardlayout
Author: Justin Black
License: UNKNOWN
Keywords: keyboard,qwerty,layout,azerty
Platform: UNKNOWN
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Intended Audience :: End Users/Desktop
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX
Classifier: Operating System :: MacOS
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Multimedia :: Graphics
Classifier: Topic :: Games/Entertainment :: Simulation
Classifier: Development Status :: 5 - Production/Stable
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Requires-Dist: PyYAML (>=5.3.1)
Requires-Dist: pygame (>=2.0.0)
Provides-Extra: dev
Requires-Dist: sphinx ; extra == 'dev'
Requires-Dist: pytest ; extra == 'dev'
Requires-Dist: setuptools ; extra == 'dev'
Requires-Dist: wheel ; extra == 'dev'
Requires-Dist: twine ; extra == 'dev'

# keyboardlayout
A python library to display different keyboards.
The keyboard layouts are created with pygame sprites.
PRs with additional layouts or graphics backends are welcome.

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:
- qwerty + azerty included
- dynamically generate a pygame sprite group showing a keyboard
- customize the keyboard with sizes, colors, key margin, padding, font, location, etc
- update a specific key with `update_key`

## Documentation
https://spacether.github.io/keyboardlayout/

## Examples
#### qwerty with colors
![qwerty colored](https://raw.githubusercontent.com/spacether/keyboardlayout/master/samples/images/qwerty_colored.jpg)

#### qwerty
![qwerty](https://raw.githubusercontent.com/spacether/keyboardlayout/master/samples/images/qwerty.jpg)

#### azerty laptop
![azerty_laptop](https://raw.githubusercontent.com/spacether/keyboardlayout/master/samples/images/azerty_laptop.jpg)

## Installation
Make sure that you are using Python3
```
pip install keyboardlayout
```

## Samples
- [qwerty](https://github.com/spacether/keyboardlayout/tree/master/samples/qwerty.py)
- [pressed keys with pygame](https://github.com/spacether/keyboardlayout/tree/master/samples/pressed_keys_pygame.py)

## Usage
```
import keyboardlayout as kl
import pygame

layout_name = 'qwerty'
pygame.init()

key_size = 60
grey = pygame.Color('grey')
keyboard_info = kl.KeyboardInfo(
    position=(0, 0),
    padding=2,
    color=~grey
)
key_info = kl.KeyInfo(
    margin=10,
    color=grey,
    txt_color=~grey,  # invert grey
    txt_font=pygame.font.SysFont('Arial', key_size//4),
    txt_padding=(key_size//6, key_size//10)
)
letter_key_size = (key_size, key_size),  # width, height
keyboard_layout = kl.KeyboardLayout(
    layout_name,
    keyboard_info,
    letter_key_size,
    key_info
)

screen = pygame.display.set_mode(
    (keyboard_layout.rect.width, keyboard_layout.rect.height))
screen.fill(pygame.Color('black'))

keyboard_layout.draw(screen)
pygame.display.update()

running = True
while running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.display.quit()
            running = False

pygame.quit()
```

## 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
```


