DisplayIO小部件,用于显示翻页时钟风格的动画,从一数字变到另一数字。
项目描述
简介
DisplayIO小部件,用于显示翻页时钟风格的动画,从一数字变到另一数字。
依赖关系
此驱动程序依赖于
此命令可用于安装PaletteFader
circup install cedargrove_palettefader
请确保所有依赖项都在CircuitPython文件系统中可用。这可以通过下载 Adafruit库和驱动程序捆绑包 或使用 circup 安装单个库轻松实现。
从PyPI安装
在支持GNU/Linux系统(如Raspberry Pi)上,您可以从PyPI本地安装驱动程序 。为当前用户安装
pip3 install adafruit-circuitpython-displayio-flipclock
为系统范围内安装(在某些情况下可能需要)
sudo pip3 install adafruit-circuitpython-displayio-flipclock
在当前项目中的虚拟环境中安装
mkdir project-name && cd project-name
python3 -m venv .venv
source .env/bin/activate
pip3 install adafruit-circuitpython-displayio-flipclock
使用Circup在连接的CircuitPython设备上安装
确保您在Python环境中安装了circup。如果需要,使用以下命令安装
pip3 install circup
安装circup并连接您的CircuitPython设备后,使用以下命令安装
circup install adafruit_displayio_flipclock
或者以下命令来更新现有版本
circup update
用法示例
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)
文档
该库的API文档可以在Read the Docs上找到。
有关构建库文档的信息,请参阅此指南。
贡献
欢迎贡献!在贡献之前,请阅读我们的行为准则,以帮助本项目保持欢迎。
项目详情
关闭
散列值 for adafruit-circuitpython-displayio-flipclock-1.1.2.tar.gz
算法 | 散列摘要 | |
---|---|---|
SHA256 | 78e34374097884f4c320af59449a0f70718575efea46b2c5a068dd88a7fb2f5e |
|
MD5 | 93b9cc6c0cc429eac13ad34bc0426053 |
|
BLAKE2b-256 | 95bf8853cc8fc573a05697fe6f237c0eab05789a0ef4a390c28f2c1d77a63c3d |
关闭
散列值 for adafruit_circuitpython_displayio_flipclock-1.1.2-py3-none-any.whl
算法 | 散列摘要 | |
---|---|---|
SHA256 | dfa75319a79d9d1f108b609f6d226710a187260fc59b3615e52b64e187cfc57d |
|
MD5 | c7b72ea2bd4d71c34003dfc2d76dada8 |
|
BLAKE2b-256 | 749bb8cb62659c58e613b9b9efa8266c1bda2586947bc28142a1807aaddbd81d |