Skip to content

Instantly share code, notes, and snippets.

# Sample for comparing label and bitmap_label positioning with Builtin or loaded BDF fonts
# pylint: disable=no-member
import gc
import time
import board
import displayio
import terminalio
from adafruit_bitmap_font import bitmap_font
@kmatch98
kmatch98 / code.py
Created August 12, 2020 21:33
Test script to evaluate memory usage of `bitmap_label.py` vs `label.py`
# Sample for comparing label and bitmap_label positioning with Builtin or loaded BDF fonts
# pylint: disable=no-member
import gc
import time
import board
import displayio
import terminalio
from adafruit_bitmap_font import bitmap_font
STARTFONT 2.1
FONT -FontForge-Black Lives Matter-Regular-R-Normal--96-920-75-75-P-402-ISO10646-1
SIZE 92 75 75
FONTBOUNDINGBOX 57 80 0 -7
COMMENT "Generated by fontforge, http://fontforge.sourceforge.net"
STARTPROPERTIES 39
FOUNDRY "FontForge"
FAMILY_NAME "Black Lives Matter"
WEIGHT_NAME "Regular"
SLANT "R"
@kmatch98
kmatch98 / Cornerstone-84.bdf
Last active August 17, 2020 22:12
Cornerstone font 84 pixels - Black Lives Matter - from https://fontmeme.com/fonts/cornerstone-free-font/
STARTFONT 2.1
FONT -FontForge-Cornerstone-Book-R-Normal--84-810-75-75-P-460-ISO10646-1
SIZE 81 75 75
FONTBOUNDINGBOX 70 79 -1 -12
COMMENT "Generated by fontforge, http://fontforge.sourceforge.net"
COMMENT "SIL Open Font License"
STARTPROPERTIES 40
FOUNDRY "FontForge"
FAMILY_NAME "Cornerstone"
WEIGHT_NAME "Book"
@kmatch98
kmatch98 / code - rainbow CircuitPython day.py
Created August 19, 2020 19:59
Rainbow Notice for CircuitPython Day 9/9/2020
import board
import terminalio
import displayio
from adafruit_display_text import bitmap_label as label
def wheel(pos):
# input a value 0 to 255 to get a color value
# the colors are a transition r-g-b-back to r.
if pos < 1 or pos > 255:
return (0,0,0)
@kmatch98
kmatch98 / reference_test.py
Created August 24, 2020 22:32
Test script evaluating TileGrid and Bitmap references
import gc
import time
import board
import displayio
import terminalio
class testGroup(displayio.Group):
def __init__(self,
color):
@kmatch98
kmatch98 / Updated adafruit_display_button.py library
Last active September 25, 2020 16:39
Button layout simplification using a grid layout.\
# The MIT License (MIT)
#
# Copyright (c) 2019 Limor Fried for Adafruit Industries
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@kmatch98
kmatch98 / adafruit_button.py
Created September 27, 2020 15:49
Adafruit Button Trials 2020_09_27
# The MIT License (MIT)
#
# Copyright (c) 2019 Limor Fried for Adafruit Industries
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@kmatch98
kmatch98 / code.py
Last active January 28, 2021 22:45
Widget: Round, horizontal switch for CircuitPython using displayio and adafruit_display_shapes. Includes a demo for the PyPortal.
# This is a trial of the switch_round_horizontal
# for use on the PyPortal
#
# To do:
# Allow color handling for both RGB tuples (255, 255, 255) or hex values (0xFFFFFF)
#
import time
#import random
import board
@kmatch98
kmatch98 / code_pyportal.py
Last active February 2, 2021 15:40
Second draft of a sliding switch widget (SwitchRoundHorizontal). Now updated with Control, Widget and WidgetLabel Classes. Includes an example to run on the PyPortal.
# This is a trial of the switch_round_horizontal
# for use on the PyPortal
#
# To do:
# Allow color handling for both RGB tuples (255, 255, 255) or hex values (0xFFFFFF)
#
import time
import board