Skip to content

Commit 21b021f

Browse files
authored
Merge pull request #18 from FoamyGuy/odb_api_update
use new OnDiskBitmap API
2 parents ee287cc + e47f8f1 commit 21b021f

File tree

3 files changed

+15
-34
lines changed

3 files changed

+15
-34
lines changed

README.rst

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,8 @@ Usage Example
9292
9393
g = displayio.Group()
9494
95-
f = open("/display-ruler.bmp", "rb")
96-
97-
pic = displayio.OnDiskBitmap(f)
98-
# CircuitPython 6 & 7 compatible
99-
t = displayio.TileGrid(
100-
pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
101-
)
102-
# CircuitPython 7 compatible only
103-
# t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
104-
95+
pic = displayio.OnDiskBitmap("/display-ruler.bmp")
96+
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
10597
g.append(t)
10698
10799
display.root_group = g
@@ -110,6 +102,7 @@ Usage Example
110102
111103
time.sleep(120)
112104
105+
113106
Documentation
114107
=============
115108

examples/il0398_4.2_color.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,12 @@
4242

4343
g = displayio.Group()
4444

45-
with open("/display-ruler.bmp", "rb") as f:
46-
pic = displayio.OnDiskBitmap(f)
47-
# CircuitPython 6 & 7 compatible
48-
t = displayio.TileGrid(
49-
pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
50-
)
51-
# CircuitPython 7 compatible only
52-
# t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
53-
g.append(t)
45+
pic = displayio.OnDiskBitmap("/display-ruler.bmp")
46+
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
47+
g.append(t)
5448

55-
display.root_group = g
49+
display.root_group = g
5650

57-
display.refresh()
51+
display.refresh()
5852

59-
time.sleep(120)
53+
time.sleep(120)

examples/il0398_simpletest.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,12 @@
3535

3636
g = displayio.Group()
3737

38-
with open("/display-ruler.bmp", "rb") as f:
39-
pic = displayio.OnDiskBitmap(f)
40-
# CircuitPython 6 & 7 compatible
41-
t = displayio.TileGrid(
42-
pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
43-
)
44-
# CircuitPython 7 compatible only
45-
# t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
46-
g.append(t)
38+
pic = displayio.OnDiskBitmap("/display-ruler.bmp")
39+
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
40+
g.append(t)
4741

48-
display.root_group = g
42+
display.root_group = g
4943

50-
display.refresh()
44+
display.refresh()
5145

52-
time.sleep(120)
46+
time.sleep(120)

0 commit comments

Comments
 (0)