dartsnut python package
Project description
pydartsnut
The python module work with Dartsnut hardware.
Installation
pip install pydartsnut
Usage
Initialize the module
from pydartsnut import Dartsnut
dartsnut = Dartsnut()
Retrieve user input parameters
params = dartsnut.widget_params
# Returns a dictionary of current widget parameters.
print(params)
# Safely get the city name from params
city_name = ""
if params is not None:
city_name = params.get("city", "")
if city_name == "":
# TODO: assign default value or show a warning image
pass
Update the frame buffer for display
from PIL import Image
image = Image.open("your_image.png")
dartsnut.update_frame_buffer(image)
# Or using a bytearray (RGB888 format)
dartsnut.update_frame_buffer(bytearray_data)
Get darts positions
darts = dartsnut.get_darts()
# Returns a list of 12 [x, y] coordinates.
# [-1, -1] means the dart is not present.
Get button states
buttons = dartsnut.get_buttons()
# Returns a dictionary:
# {
# "btn_a": False,
# "btn_b": False,
# "btn_up": False,
# "btn_right": False,
# "btn_left": False,
# "btn_down": False,
# "btn_home": False,
# "btn_reserved": False,
# }
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
pydartsnut-1.0.0.tar.gz
(8.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pydartsnut-1.0.0.tar.gz.
File metadata
- Download URL: pydartsnut-1.0.0.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d37a2f7b77d11404a9ade9884274bf59a386161768d73067ef4b256215d4f53b
|
|
| MD5 |
95dce165c748de50ea7a9d157fbbfe2f
|
|
| BLAKE2b-256 |
9ea66a5e2804874dfa78e13d9c62ec5029e15e3625e6097cfd1d55e56da790da
|
File details
Details for the file pydartsnut-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pydartsnut-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9557caeeace7629d1bb6084a906862aacca45d6c4d9100769963f5825949fa9
|
|
| MD5 |
f3d86c17165be153efe241887be0423f
|
|
| BLAKE2b-256 |
2c1b93ac679d20fd5c327cc16dfc0309f7598d8e9317f57b97ddb1944d7f5122
|