kopia lustrzana https://github.com/peterhinch/micropython-nano-gui
check_colors.py Test/demo program for any nano-gui displays.
Fill the screen with stripes of all colors. Frame the screen.pull/9/head
rodzic
faa71b33d9
commit
a41ad129c9
|
@ -1,8 +1,13 @@
|
|||
from color_setup import ssd # Create a display instance
|
||||
# check_colors.py Test/demo program for any nano-gui displays
|
||||
|
||||
# Released under the MIT License (MIT). See LICENSE.
|
||||
# Copyright (c) 2021 Ihor Nehrutsa
|
||||
|
||||
from color_setup import * # Create a display instance
|
||||
from gui.core.colors import *
|
||||
from gui.core.nanogui import refresh
|
||||
|
||||
refresh(ssd, True) # Initialise and clear display.
|
||||
refresh(ssd, clear=True) # Initialise and clear display.
|
||||
# Uncomment for ePaper displays
|
||||
# ssd.wait_until_ready()
|
||||
# ssd.fill(0)
|
||||
|
@ -10,11 +15,19 @@ refresh(ssd, True) # Initialise and clear display.
|
|||
# Fill the display with stripes of all colors
|
||||
COLORS = 16
|
||||
dh = ssd.height // COLORS
|
||||
dw = ssd.width // COLORS
|
||||
for c in range(0, COLORS):
|
||||
h = dh * c
|
||||
w = dw * c
|
||||
ssd.fill_rect(w, 0, w + dw, ssd.height - 1, c)
|
||||
#ssd.fill_rect(0, h, ssd.width - 1, h + dh, c)
|
||||
ssd.fill_rect(0, h, ssd.width, h + dh, c)
|
||||
if dh * COLORS < ssd.height:
|
||||
ssd.fill_rect(0, dh * COLORS, ssd.width, ssd.height - dh * COLORS, BLACK) # Fill in the remaining blank area at the bottom
|
||||
|
||||
# half frame at the top of the screen
|
||||
ssd.line(0, 0, ssd.width - 1, 0, WHITE) # top line from left to right
|
||||
ssd.line(0, 0, 0, ssd.height // 2, WHITE) # left line from top to middle
|
||||
ssd.line(ssd.width - 1, 0, ssd.width - 1, ssd.height // 2, WHITE) # right line from top to middle
|
||||
# half frame at the bottom of the screen
|
||||
ssd.line(0, ssd.height//2, 0, ssd.height-1, MAGENTA) # left line from middle to bottom
|
||||
ssd.line(ssd.width - 1, ssd.height//2, ssd.width - 1, ssd.height-1, MAGENTA) # right line from middle to bottom
|
||||
ssd.line(0, ssd.height-1, ssd.width - 1, ssd.height-1, MAGENTA) # bottom line from left to right
|
||||
|
||||
ssd.show()
|
||||
|
|
Ładowanie…
Reference in New Issue