Skip to main content

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-0.1.1.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydartsnut-0.1.1-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file pydartsnut-0.1.1.tar.gz.

File metadata

  • Download URL: pydartsnut-0.1.1.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.13

File hashes

Hashes for pydartsnut-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4df407e0c11ff9933c193b610a9ef44c2d54ef99e5921eac2be235980bd84382
MD5 3f13fd30a3f8fe385d3640a5a39306c6
BLAKE2b-256 a3c148ec589b8e5cde4b0dc86fb1318c0b5efe6775b10ae6d67b565b677f064a

See more details on using hashes here.

File details

Details for the file pydartsnut-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pydartsnut-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.13

File hashes

Hashes for pydartsnut-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6b684add19d72c622416844787914f335f8e23c8ec22723c1a30a12d54acc30c
MD5 ab13cdfb2dcc17c1f76936191cb97494
BLAKE2b-256 b0cd2d3cd5b4cc90b6d7e5cfffa3ea5bcf321a080050d83896963ef6aca0e0e2

See more details on using hashes here.

Supported by

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