pychroma
Python library for accessing the Razer Chroma SDK
pychroma provides general-purpose access to the Razer Chroma SDK REST API for control over the LEDs of Razer devices. The work environment is easy to set up and it features a sketch and (optionally) a controller. The sketch code structure is heavily inspired from p5js.org conventions. The controller allows having multiple sketches.
Features
- Full controll over the LEDs via Chroma SDK
- Low barrier to entry for educators and practitioners
Made for everyone
- Simply use the sketch! This library is accessible and inclusive for artists, designers, educators and beginners
- Gain more access by using the controller or handling the connection and devices all by yourself
- If you want to have full control then fork this repository and edit the source code
Installation
This repo is tested on Python 3.8.3, requests 2.23.0 and pynput 1.6.8
With pip
pychroma can be installed using pip as follows:
pip install pychroma
From source
You can install from source by cloning the repository and running:
git clone https://github.com/morswin22/pychroma
cd pychroma
pip install .
When you update the repository, you should upgrade the pychroma installation and its dependencies as follows:
git pull
pip install --upgrade .
Run the examples
You can download the examples from the examples repo
Look at the README included with examples for more information
Tests
A series of tests are included for the library. Library tests can be found in the tests folder.
Here's the easiest way to run tests for the library:
python -m unittest discover -v -s ./tests -p test*.py
If you are using Visual Studio Code then you can use it's built in testing with python add-on
Quick Tour
Check out the wiki for detailed documentation.
Create a configuration file in JSON format.
{
"chroma": {
"developerName": "Your name",
"developerContact": "Your email",
"category": "application",
"supportedDevices": ["keyboard"],
"description": "Basic hello world sketch",
"title": "Hello world!"
}
}
Creating a sketch
from pychroma import Sketch
class MySketch(Sketch):
config_path = 'path/to/config/file.json'
Example animation code
from pychroma import Sketch
class MySketch(Sketch):
config_path = 'path/to/config/file.json'
def setup(self):
self.frame_rate = 30
self.keyboard.color_mode('hsv')
self.hue = 0
def update(self):
self.hue += 1
if self.hue == 360:
self.stop()
def render(self):
self.keyboard.set_static((self.hue, 100, 100))
Metadata
Release files for pychroma 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pychroma-0.0.2.tar.gz | 9.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pychroma-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.9 kB
Release files / pychroma-0.0.2.tar.gz
| Download URL | pychroma-0.0.2.tar.gz |
|---|---|
| Size | 9.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
22ec9231f2f4ddd1e5aa81547144beaf1b587b383ed5f3472f9e40ef12ab7939
|
|
BLAKE2b-256 checksum How to use checksums |
7c8bc102776c839ce5dfa75392f38a2976fd88980eb049b7c07f9a909e418648
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
|
Release files / pychroma-0.0.2-py3-none-any.whl
| Download URL | pychroma-0.0.2-py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cdd9f6c3cb6db351bba452286f67c8ba66f2b61e43bb63d488af11eac10b203a
|
|
BLAKE2b-256 checksum How to use checksums |
961193165a30569f19281791f8c88960ff26383ad7596cf4721a512e2e223966
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
|