Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions EInk_CircuitPython_Quickstart/213_tricolor_eink_fw_badge.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,27 @@
g.append(bg_sprite)

# Display a picture from the root directory of the CIRCUITPY drive
# Picture should be HEIGHTxHEIGHT square idealy for a portrait
# Picture should be HEIGHTxHEIGHT square ideally for a portrait
# But could be the entire WIDTHxHEIGHT for a non-portrait
f = open("/picture.bmp", "rb")
filename = "/picture.bmp"

pic = displayio.OnDiskBitmap(f)
# Create a Tilegrid with the bitmap and put in the displayio group
t = displayio.TileGrid(pic, pixel_shader=getattr(pic, 'pixel_shader', displayio.ColorConverter()))

# CircuitPython 6 & 7 compatible
pic = displayio.OnDiskBitmap(open(filename, "rb"))
t = displayio.TileGrid(
pic, pixel_shader=getattr(pic, 'pixel_shader', displayio.ColorConverter())
)
g.append(t)

# # CircuitPython 7+ compatible
# pic = displayio.OnDiskBitmap(filename)
# t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
# g.append(t)

# Draw simple text using the built-in font into a displayio group
# For smaller text, change scale=2 to scale=1
text_group = displayio.Group(max_size=10, scale=2,
text_group = displayio.Group(scale=2,
x=DISPLAY_HEIGHT + 10,
y=int(DISPLAY_HEIGHT/2) - 13)
first_name = "Limor"
Expand All @@ -88,7 +97,7 @@
g.append(text_group)

# Draw simple text using the built-in font into a displayio group
text_group = displayio.Group(max_size=10, scale=2,
text_group = displayio.Group(scale=2,
x=DISPLAY_HEIGHT + 10,
y=int(DISPLAY_HEIGHT/2) + 13)
last_name = "Ladyada"
Expand Down
4 changes: 2 additions & 2 deletions EInk_CircuitPython_Quickstart/213_tricolor_eink_fw_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
highlight_color=0xff0000)

# Create a display group for our screen objects
g = displayio.Group(max_size=10)
g = displayio.Group()

# Set a background
background_bitmap = displayio.Bitmap(DISPLAY_WIDTH, DISPLAY_HEIGHT, 1)
Expand All @@ -67,7 +67,7 @@
g.append(t)

# Draw simple text using the built-in font into a displayio group
text_group = displayio.Group(max_size=10, scale=2, x=20, y=40)
text_group = displayio.Group(scale=2, x=20, y=40)
text = "Hello World!"
text_area = label.Label(terminalio.FONT, text=text, color=FOREGROUND_COLOR)
text_group.append(text_area) # Add this text to the text group
Expand Down
23 changes: 16 additions & 7 deletions EInk_CircuitPython_Quickstart/27_tricolor_eink_shield_badge.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
highlight_color=0xff0000, rotation=90)

# Create a display group for our screen objects
g = displayio.Group(max_size=10)
g = displayio.Group()

# Set a background
background_bitmap = displayio.Bitmap(DISPLAY_WIDTH, DISPLAY_HEIGHT, 1)
Expand All @@ -63,19 +63,28 @@
g.append(bg_sprite)

# Display a picture from the root directory of the CIRCUITPY drive
# Picture should be HEIGHTxHEIGHT square idealy for a portrait
# Picture should be HEIGHTxHEIGHT square ideally for a portrait
# But could be the entire WIDTHxHEIGHT for a non-portrait
f = open("/picture.bmp", "rb")
filename = "/picture.bmp"

pic = displayio.OnDiskBitmap(f)
# Create a Tilegrid with the bitmap and put in the displayio group
t = displayio.TileGrid(pic, pixel_shader=getattr(pic, 'pixel_shader', displayio.ColorConverter()))

# CircuitPython 6 & 7 compatible
pic = displayio.OnDiskBitmap(open(filename, "rb"))
t = displayio.TileGrid(
pic, pixel_shader=getattr(pic, 'pixel_shader', displayio.ColorConverter())
)
g.append(t)

# # CircuitPython 7+ compatible
# pic = displayio.OnDiskBitmap(filename)
# t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
# g.append(t)

# Draw simple text using the built-in font into a displayio group
# For smaller text, change scale=2 to scale=1 as scale 2 doesn't
# allow for much text but the text is bigger.
text_group = displayio.Group(max_size=10, scale=2,
text_group = displayio.Group(scale=2,
x=DISPLAY_HEIGHT + 5,
y=int(DISPLAY_HEIGHT/2) - 13)
first_name = "Limor"
Expand All @@ -87,7 +96,7 @@
# Draw simple text using the built-in font into a displayio group
# For smaller text, change scale=2 to scale=1 as scale 2 doesn't
# allow for much text but the text is bigger.
text_group = displayio.Group(max_size=10, scale=2,
text_group = displayio.Group(scale=2,
x=DISPLAY_HEIGHT + 5,
y=int(DISPLAY_HEIGHT/2) + 13)
last_name = "Fried"
Expand Down
4 changes: 2 additions & 2 deletions EInk_CircuitPython_Quickstart/27_tricolor_eink_shield_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
highlight_color=0xff0000, rotation=90)

# Create a display group for our screen objects
g = displayio.Group(max_size=10)
g = displayio.Group()

# Set a white background
background_bitmap = displayio.Bitmap(DISPLAY_WIDTH, DISPLAY_HEIGHT, 1)
Expand All @@ -61,7 +61,7 @@
g.append(t)

# Draw simple text using the built-in font into a displayio group
text_group = displayio.Group(max_size=10, scale=2, x=40, y=40)
text_group = displayio.Group(scale=2, x=40, y=40)
text = "Hello World!"
text_area = label.Label(terminalio.FONT, text=text, color=FOREGROUND_COLOR)
text_group.append(text_area) # Add this text to the text group
Expand Down