from display_layouts.absolute_layout import AbsoluteLayout from blinka_displayio_pygamedisplay import PyGameDisplay import os os.chdir("..") display = PyGameDisplay(width=800, height=600) f = open("layouts/label_xy_test.json", "r") layout_str = f.read() f.close() main_layout = AbsoluteLayout(display, layout_str) display.show(main_layout.view) #main_layout.sub_view_by_index(0).label.text = "Changed Text\nBy Index" main_layout.sub_view_by_id("main_lbl").label.text = "Changed\nText By Id" main_layout.sub_view_by_id("main_lbl").update_position() while display.running: pass
import board import displayio from display_layouts.absolute_layout import AbsoluteLayout f = open("layouts/test_unsafe_eval.json", "r") layout_str = f.read() f.close() main_layout = AbsoluteLayout(board.DISPLAY, layout_str) board.DISPLAY.show(main_layout.view) while True: pass
import random import time import board import displayio from display_layouts.absolute_layout import AbsoluteLayout display = board.DISPLAY f = open("layouts/sparkline_test.json", "r") layout_str = f.read() f.close() main_layout = AbsoluteLayout(display, layout_str) display.show(main_layout.view) _sparkline = main_layout.sub_view_by_id("main_sparkline").sparkline # Loop and look for touches while True: # turn off the auto_refresh of the display while modifying the sparkline display.auto_refresh = False # add_value: add a new value to a sparkline # Note: The y-range for mySparkline1 is set to 0 to 10, so all these random # values (between 0 and 10) will fit within the visible range of this sparkline _sparkline.add_value(random.uniform(0, 10)) # turn the display auto_refresh back on display.auto_refresh = True
import displayio from display_layouts.absolute_layout import AbsoluteLayout import adafruit_touchscreen # Setup touchscreen (PyPortal) ts = adafruit_touchscreen.Touchscreen( board.TOUCH_XL, board.TOUCH_XR, board.TOUCH_YD, board.TOUCH_YU, calibration=((5200, 59000), (5800, 57000)), size=(320, 240), ) f = open("layouts/button_test.json", "r") layout_str = f.read() f.close() main_layout = AbsoluteLayout(board.DISPLAY, layout_str) board.DISPLAY.show(main_layout.view) _button = main_layout.sub_view_by_id("main_btn").button # Loop and look for touches while True: p = ts.touch_point if p: if _button.contains(p): _button.selected = True else: _button.selected = False
import board import displayio from display_layouts.absolute_layout import AbsoluteLayout f = open("layouts/badge_test.json", "r") layout_str = f.read() f.close() main_layout = AbsoluteLayout(board.DISPLAY, layout_str) board.DISPLAY.show(main_layout.view) main_layout.sub_view_by_id("name_lbl").label.text = "Blinka" main_layout.sub_view_by_id("name_lbl").update_position() while True: pass
import board import time import displayio from display_layouts.absolute_layout import AbsoluteLayout f = open("layouts/progress_bar_test.json", "r") layout_str = f.read() f.close() main_layout = AbsoluteLayout(board.DISPLAY, layout_str) board.DISPLAY.show(main_layout.view) _progress = main_layout.sub_view_by_id("main_progress").view while True: for current_progress in range(0, 101, 1): print("Progress: {}%".format(current_progress)) _progress.progress = current_progress / 100 # convert to decimal time.sleep(0.01) time.sleep(0.3) _progress.progress = 0.0 time.sleep(0.3)
import time from display_layouts.absolute_layout import AbsoluteLayout from blinka_displayio_pygamedisplay import PyGameDisplay import os os.chdir("..") display = PyGameDisplay(width=800, height=600) f = open("layouts/progress_bar_test.json", "r") layout_str = f.read() f.close() main_layout = AbsoluteLayout(display, layout_str) display.show(main_layout.view) _progress = main_layout.sub_view_by_id("main_progress").view while display.running: for current_progress in range(0, 101, 1): print("Progress: {}%".format(current_progress)) _progress.progress = current_progress / 100 # convert to decimal time.sleep(0.01) time.sleep(0.3) _progress.progress = 0.0 time.sleep(0.3)
from display_layouts.absolute_layout import AbsoluteLayout from blinka_displayio_pygamedisplay import PyGameDisplay import os os.chdir("..") display = PyGameDisplay(width=800, height=600) f = open("layouts/shapes_test.json", "r") layout_str = f.read() f.close() main_layout = AbsoluteLayout(display, layout_str) display.show(main_layout.view) while display.running: pass
TIMER_TARGET_TIME = -1 QUICK_TIMER_SETTING = -1 CUSTOM_TIMER_SETTING = 0 PAUSE_START_TIME = -1 STOPWATCH_START_TIME = -1 pixels = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.15) pixels[0] = (0, 0, 0) minitft = minitft_featherwing.MiniTFTFeatherWing() f = open("minitft_featherwing_gadget/layouts/main_menu.json", "r") layout_str = f.read() f.close() main_menu_layout = AbsoluteLayout(minitft.display, layout_str) f = open("minitft_featherwing_gadget/layouts/quick_timer.json", "r") layout_str = f.read() f.close() quick_timer_layout = AbsoluteLayout(minitft.display, layout_str) quick_timer_5min_lbl = quick_timer_layout.sub_view_by_id("5min_lbl") quick_timer_10min_lbl = quick_timer_layout.sub_view_by_id("10min_lbl") quick_timer_25min_lbl = quick_timer_layout.sub_view_by_id("25min_lbl") quick_timer_50min_lbl = quick_timer_layout.sub_view_by_id("50min_lbl") f = open("minitft_featherwing_gadget/layouts/quick_timer_running.json", "r") layout_str = f.read() f.close() quick_timer_running_layout = AbsoluteLayout(minitft.display, layout_str)