use new OnDiskBitmap API
This commit is contained in:
parent
776b932ebf
commit
95ad8510a8
3 changed files with 31 additions and 31 deletions
18
README.rst
18
README.rst
|
|
@ -123,16 +123,20 @@ Usage Example
|
|||
|
||||
g = displayio.Group()
|
||||
|
||||
with open("/display-ruler.bmp", "rb") as f:
|
||||
pic = displayio.OnDiskBitmap(f)
|
||||
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
|
||||
g.append(t)
|
||||
pic = displayio.OnDiskBitmap("/display-ruler.bmp")
|
||||
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
|
||||
g.append(t)
|
||||
|
||||
display.root_group = g
|
||||
# Place the display group on the screen
|
||||
display.root_group = g
|
||||
|
||||
display.refresh()
|
||||
# Refresh the display to have it actually show the image
|
||||
# NOTE: Do not refresh eInk displays sooner than 180 seconds
|
||||
display.refresh()
|
||||
print("refreshed")
|
||||
|
||||
time.sleep(180)
|
||||
|
||||
time.sleep(120)
|
||||
|
||||
|
||||
Documentation
|
||||
|
|
|
|||
|
|
@ -44,23 +44,16 @@ display = adafruit_uc8151d.UC8151D(
|
|||
g = displayio.Group()
|
||||
|
||||
# Display a ruler graphic from the root directory of the CIRCUITPY drive
|
||||
with open("/display-ruler.bmp", "rb") as f:
|
||||
pic = displayio.OnDiskBitmap(f)
|
||||
# Create a Tilegrid with the bitmap and put in the displayio group
|
||||
# CircuitPython 6 & 7 compatible
|
||||
t = displayio.TileGrid(
|
||||
pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
|
||||
)
|
||||
# CircuitPython 7 compatible only
|
||||
# t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
|
||||
g.append(t)
|
||||
pic = displayio.OnDiskBitmap("/display-ruler.bmp")
|
||||
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
|
||||
g.append(t)
|
||||
|
||||
# Place the display group on the screen
|
||||
display.root_group = g
|
||||
# Place the display group on the screen
|
||||
display.root_group = g
|
||||
|
||||
# Refresh the display to have it actually show the image
|
||||
# NOTE: Do not refresh eInk displays sooner than 180 seconds
|
||||
display.refresh()
|
||||
print("refreshed")
|
||||
# Refresh the display to have it actually show the image
|
||||
# NOTE: Do not refresh eInk displays sooner than 180 seconds
|
||||
display.refresh()
|
||||
print("refreshed")
|
||||
|
||||
time.sleep(180)
|
||||
time.sleep(180)
|
||||
|
|
|
|||
|
|
@ -37,13 +37,16 @@ display = adafruit_uc8151d.UC8151D(
|
|||
|
||||
g = displayio.Group()
|
||||
|
||||
with open("/display-ruler.bmp", "rb") as f:
|
||||
pic = displayio.OnDiskBitmap(f)
|
||||
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
|
||||
g.append(t)
|
||||
pic = displayio.OnDiskBitmap("/display-ruler.bmp")
|
||||
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
|
||||
g.append(t)
|
||||
|
||||
display.root_group = g
|
||||
# Place the display group on the screen
|
||||
display.root_group = g
|
||||
|
||||
display.refresh()
|
||||
# Refresh the display to have it actually show the image
|
||||
# NOTE: Do not refresh eInk displays sooner than 180 seconds
|
||||
display.refresh()
|
||||
print("refreshed")
|
||||
|
||||
time.sleep(120)
|
||||
time.sleep(180)
|
||||
|
|
|
|||
Loading…
Reference in a new issue