Skip to main content

Frame Message Package

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

Frame SDK documentation.

Examples repo on GitHub.

Installation

pip install frame-msg

Usage

import asyncio
from pathlib import Path

from frame_msg import FrameMsg, 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 = FrameMsg()
    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())

Acknowledgements

Metadata

Release files for frame-msg 5.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for frame-msg 5.2.1
File Size Uploaded Provenance Actions
frame_msg-5.2.1.tar.gz 24.2 kB Without provenance Details for frame_msg-5.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for frame-msg 5.2.1
File Interpreter ABI Platform Actions
frame_msg-5.2.1-py3-none-any.whl Python 3 none any Details for frame_msg-5.2.1-py3-none-any.whl

Total release size: 64.5 kB

Release files / frame_msg-5.2.1.tar.gz

Download URL frame_msg-5.2.1.tar.gz
Size 24.2 kB
Tags Source
SHA-256 checksum
How to use checksums
82a746b73d36dd36bfae2d933ac0d897f5e5149a910e3a3e4ab9d42a0af9a172
BLAKE2b-256 checksum
How to use checksums
272a4e1b1f850ffc4fd94a30917d21a05d794dbe197ff83a2c4093aec91e8bfe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.8

Release files / frame_msg-5.2.1-py3-none-any.whl

Download URL frame_msg-5.2.1-py3-none-any.whl
Size 40.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e184f69e50eb6fba40d5a3553df7eb8a19913dc6c9c288b8d5bb0a1e6c98c8d1
BLAKE2b-256 checksum
How to use checksums
8ac10e1c476af91f568a3696bdf2a6f5a37a4ec89822ff084c3e35281dc28963
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.8

Security for frame-msg 5.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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