Skip to main content

Python library for accessing the Razer Chroma SDK

Project description

pychroma

License Python Version

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))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pychroma-0.0.2.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

pychroma-0.0.2-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file pychroma-0.0.2.tar.gz.

File metadata

  • Download URL: pychroma-0.0.2.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for pychroma-0.0.2.tar.gz
Algorithm Hash digest
SHA256 22ec9231f2f4ddd1e5aa81547144beaf1b587b383ed5f3472f9e40ef12ab7939
MD5 a537fb77a5427b1a741b5efefc5dc3dd
BLAKE2b-256 7c8bc102776c839ce5dfa75392f38a2976fd88980eb049b7c07f9a909e418648

See more details on using hashes here.

File details

Details for the file pychroma-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: pychroma-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for pychroma-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cdd9f6c3cb6db351bba452286f67c8ba66f2b61e43bb63d488af11eac10b203a
MD5 bf64bed6746afa4caddb0be691a1d0ac
BLAKE2b-256 961193165a30569f19281791f8c88960ff26383ad7596cf4721a512e2e223966

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page