Skip to content

Commit 50a46d3

Browse files
committed
add showing_page_content property getter.
1 parent d16c877 commit 50a46d3

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

adafruit_displayio_layout/layouts/page_layout.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,14 @@ def showing_page_name(self):
188188
def showing_page_name(self, new_name):
189189
self.show_page(page_name=new_name)
190190

191+
@property
192+
def showing_page_content(self):
193+
"""
194+
The content object for the currently showing page
195+
:return Displayable: showing_page_content
196+
"""
197+
return self._page_content_list[self._cur_showing_index]["content"][0]
198+
191199
def next_page(self, loop=True):
192200
"""
193201
Hide the current page and show the next one in the list by index

examples/displayio_layout_page_layout_advancedtest.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,16 @@
9595
print("showing page name: {}".format(test_page_layout.showing_page_name))
9696
time.sleep(5)
9797

98+
another_text = Label(
99+
terminalio.FONT,
100+
text="And another thing!",
101+
scale=2,
102+
color=0x00FF00,
103+
anchor_point=(0, 0),
104+
anchored_position=(100, 100),
105+
)
106+
test_page_layout.showing_page_content.append(another_text)
107+
98108
print("starting loop")
99109
while True:
100110
time.sleep(1)

0 commit comments

Comments
 (0)