Skip to main content

Brilliant Message Package

A Python package for handling rich application-level messages for Brilliant Labs Frame and Halo devices, including sprites, text, audio, IMU data, and photos.

Frame SDK documentation.

Examples on GitHub.

Installation

uv add brilliant-msg

Usage

import asyncio
from pathlib import Path

from brilliant_msg import BrilliantMsg, TxSprite

async def main():
    """
    Displays sample images on the Frame display.

    The images are indexed (palette) PNG images, in 2, 4, and 16 colors (that is, 1-, 2- and 4-bits-per-pixel).
    """
    frame = BrilliantMsg()
    try:
        await frame.connect()

        # Let the user know we're starting
        await frame.print_short_text('Loading...')

        # send the std lua files to Frame that handle data accumulation and sprite parsing
        await frame.upload_stdlua_libs(lib_names=['data', 'sprite'])

        # Send the main lua application from this project to Frame that will run the app
        await frame.upload_frame_app(local_filename="lua/sprite_frame_app.lua")

        # attach the print response handler so we can see stdout from Frame Lua print() statements
        frame.attach_print_response_handler()

        # "require" the main frame_app lua file to run it, and block until it has started.
        await frame.start_frame_app()

        # send the 1-bit image to Frame in chunks
        sprite = TxSprite.from_indexed_png_bytes(Path("images/logo_1bit.png").read_bytes())
        await frame.send_message(0x20, sprite.pack())

        # send a 2-bit image
        sprite = TxSprite.from_indexed_png_bytes(Path("images/street_2bit.png").read_bytes())
        await frame.send_message(0x20, sprite.pack())

        # send a 4-bit image
        sprite = TxSprite.from_indexed_png_bytes(Path("images/hotdog_4bit.png").read_bytes())
        await frame.send_message(0x20, sprite.pack())

        await asyncio.sleep(5.0)

        # unhook the print handler
        frame.detach_print_response_handler()

        # break out of the frame app loop and reboot Frame
        await frame.stop_frame_app()

    except Exception as e:
        print(f"An error occurred: {e}")
    finally:
        # clean disconnection
        await frame.disconnect()

if __name__ == "__main__":
    asyncio.run(main())

Running Tests

From the workspace root:

cd python
uv sync --all-packages --extra tests
uv run pytest packages/brilliant_msg/tests/

The test suite covers all Tx message packing (TxCode, TxPlainText, TxSpriteCoords, TxCaptureSettings, TxAutoExpSettings, TxSprite bit-packing and factory methods, TxImageSpriteBlock, TxTextSpriteBlock) and Rx message parsing (RxAudio WAV conversion, RxMeteringData, RxAutoExpResult, RxIMU including IMUData pitch/roll and SensorBuffer smoothing, RxTap, and BrilliantMsg handler dispatch). No hardware is required.

Download files

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

Source Distribution

brilliant_msg-7.1.1.tar.gz (44.8 kB view details)

Uploaded Source

Built Distribution

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

brilliant_msg-7.1.1-py3-none-any.whl (48.1 kB view details)

Uploaded Python 3

File details

Details for the file brilliant_msg-7.1.1.tar.gz.

File metadata

  • Download URL: brilliant_msg-7.1.1.tar.gz
  • Upload date:
  • Size: 44.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for brilliant_msg-7.1.1.tar.gz
Algorithm Hash digest
SHA256 8870cd655f530bf331cc0aec37713d472f27e694430e756ce2de8e9686489657
MD5 c89f0e0da02af83d4b421b6c98dc62cd
BLAKE2b-256 c2b3c7735cbcebeba17be044e81d4ed9db3fa4cb04ca9b7b8b2f3c22f768a091

See more details on using hashes here.

File details

Details for the file brilliant_msg-7.1.1-py3-none-any.whl.

File metadata

  • Download URL: brilliant_msg-7.1.1-py3-none-any.whl
  • Upload date:
  • Size: 48.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for brilliant_msg-7.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 49c5e5001f858b8609d9f550479aaa372d843771e879c158a911f35f3a21b96e
MD5 4d495c11cc97e8b0785963bbfcce1ee8
BLAKE2b-256 df4596e5bcbf168fb896e32dc5babb6210f4ed0312cf5a061f60791b29f57890

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

7.1.1 This release

2 files

7.1.0

2 files

7.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page