|
15 | 15 | display_group = displayio.Group() |
16 | 16 |
|
17 | 17 | # Display a ruler graphic from the root directory of the CIRCUITPY drive |
18 | | -with open("/display-ruler.bmp", "rb") as file: |
19 | | - picture = displayio.OnDiskBitmap(file) |
20 | | - # Create a Tilegrid with the bitmap and put in the displayio group |
21 | | - # CircuitPython 6 & 7 compatible |
22 | | - sprite = displayio.TileGrid( |
23 | | - picture, |
24 | | - pixel_shader=getattr(picture, "pixel_shader", displayio.ColorConverter()), |
25 | | - ) |
26 | | - # CircuitPython 7 compatible only |
27 | | - # sprite = displayio.TileGrid(picture, pixel_shader=bitmap.pixel_shader) |
28 | | - display_group.append(sprite) |
29 | | - |
30 | | - # Place the display group on the screen |
31 | | - display.root_group = display_group |
32 | | - |
33 | | - # Refresh the display to have it actually show the image |
34 | | - # NOTE: Do not refresh eInk displays sooner than 180 seconds |
35 | | - display.refresh() |
36 | | - print("refreshed") |
37 | | - |
38 | | - time.sleep(180) |
| 18 | +picture = displayio.OnDiskBitmap("/display-ruler.bmp") |
| 19 | +# Create a Tilegrid with the bitmap and put in the displayio group |
| 20 | +sprite = displayio.TileGrid(picture, pixel_shader=picture.pixel_shader) |
| 21 | +display_group.append(sprite) |
| 22 | + |
| 23 | +# Place the display group on the screen |
| 24 | +display.root_group = display_group |
| 25 | + |
| 26 | +# Refresh the display to have it actually show the image |
| 27 | +# NOTE: Do not refresh eInk displays sooner than 180 seconds |
| 28 | +display.refresh() |
| 29 | +print("refreshed") |
| 30 | + |
| 31 | +time.sleep(180) |
0 commit comments