Skip to main content

Introduction

Documentation Status Discord Build Status Code Style: Ruff

DisplayIO widgets for showing flip clock style animattions changing from one number to another.

Dependencies

This driver depends on:

This command can be used to install the PaletteFader:

circup install cedargrove_palettefader

Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle or individual libraries can be installed using circup.

Purchase Feather ESP32-S2 TFT from the Adafruit shop

Installing from PyPI

On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:

pip3 install adafruit-circuitpython-displayio-flipclock

To install system-wide (this may be required in some cases):

sudo pip3 install adafruit-circuitpython-displayio-flipclock

To install in a virtual environment in your current project:

mkdir project-name && cd project-name
python3 -m venv .venv
source .env/bin/activate
pip3 install adafruit-circuitpython-displayio-flipclock

Installing to a Connected CircuitPython Device with Circup

Make sure that you have circup installed in your Python environment. Install it with the following command if necessary:

pip3 install circup

With circup installed and your CircuitPython device connected use the following command to install:

circup install adafruit_displayio_flipclock

Or the following command to update an existing version:

circup update

Usage Example

import time
from displayio import Group
import board
import adafruit_imageload
from adafruit_displayio_flipclock.flip_digit import FlipDigit


ANIMATION_DELAY = 0.02
ANIMATION_FRAME_COUNT = 10
TRANSPARENT_INDEXES = range(11)
BRIGHTER_LEVEL = 0.99
DARKER_LEVEL = 0.5
MEDIUM_LEVEL = 0.9

display = board.DISPLAY
main_group = Group()

static_spritesheet, static_palette = adafruit_imageload.load("static_sheet.bmp")
static_palette.make_transparent(0)

top_animation_spritesheet, top_animation_palette = adafruit_imageload.load(
    "grey_top_animation_sheet.bmp"
)
bottom_animation_spritesheet, bottom_animation_palette = adafruit_imageload.load(
    "grey_bottom_animation_sheet.bmp"
)

for i in TRANSPARENT_INDEXES:
    top_animation_palette.make_transparent(i)
    bottom_animation_palette.make_transparent(i)

SPRITE_WIDTH = static_spritesheet.width // 3
SPRITE_HEIGHT = (static_spritesheet.height // 4) // 2

flip_digit = FlipDigit(
    static_spritesheet,
    static_palette,
    top_animation_spritesheet,
    top_animation_palette,
    bottom_animation_spritesheet,
    bottom_animation_palette,
    SPRITE_WIDTH,
    SPRITE_HEIGHT,
    anim_frame_count=ANIMATION_FRAME_COUNT,
    anim_delay=ANIMATION_DELAY,
    brighter_level=BRIGHTER_LEVEL,
    darker_level=DARKER_LEVEL,
    medium_level=MEDIUM_LEVEL,
)

flip_digit.anchor_point = (0.5, 0.5)
flip_digit.anchored_position = (display.width // 2, display.height // 2)

main_group.append(flip_digit)

display.root_group = main_group

while True:
    for i in range(10):
        flip_digit.value = i
        time.sleep(0.75)

Documentation

API documentation for this library can be found on Read the Docs.

For information on building library documentation, please check out this guide.

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

Release files for adafruit-circuitpython-displayio-flipclock 1.1.10

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

Source distribution (sdist)

Source distribution for adafruit-circuitpython-displayio-flipclock 1.1.10
File Size Uploaded
adafruit_circuitpython_displayio_flipclock-1.1.10.tar.gz 165.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for adafruit-circuitpython-displayio-flipclock 1.1.10
File Interpreter ABI Platform
adafruit_circuitpython_displayio_flipclock-1.1.10-py3-none-any.whl Python 3 none any Details

Total release size: 176.3 kB

Release files / adafruit_circuitpython_displayio_flipclock-1.1.10.tar.gz

Download URL adafruit_circuitpython_displayio_flipclock-1.1.10.tar.gz
Size 165.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4fea4d14b0e69ee9d8ec294fcbf8176cdce6195ec53e126ace728be2c6e6772a
BLAKE2b-256 checksum
How to use checksums
f6e43ab86f03dcacb9a0f7a3ace928e243cf7195a6bcf4bb29dd3296a85e6478
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / adafruit_circuitpython_displayio_flipclock-1.1.10-py3-none-any.whl

Download URL adafruit_circuitpython_displayio_flipclock-1.1.10-py3-none-any.whl
Size 10.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
56c1526bf7eb1b69cdc4f3aa0a64efb9ff3c6c14736e307adffcce0cc417afb1
BLAKE2b-256 checksum
How to use checksums
60de80291c4b27db92b59e6d2f409d1e26ad1073169f904ed16bb3503d720706
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release history Release notifications | RSS feed

This release

1.1.10 This release

2 release files

1.1.9

2 release files

1.1.8

2 release files

1.1.7

2 release files

1.1.6

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release 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