-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththird_page.py
More file actions
32 lines (26 loc) · 1008 Bytes
/
third_page.py
File metadata and controls
32 lines (26 loc) · 1008 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from typing import Any
import pythonnative as pn
try:
# Optional: iOS styling support (safe if rubicon isn't available)
from rubicon.objc import ObjCClass
UIColor = ObjCClass("UIColor")
except Exception: # pragma: no cover
UIColor = None
class ThirdPage(pn.Page):
def __init__(self, native_instance: Any) -> None:
super().__init__(native_instance)
def on_create(self) -> None:
super().on_create()
stack = pn.StackView()
stack.add_view(pn.Label("This is the Third Page"))
back_btn = pn.Button("Back")
# Style button on iOS similar to MainPage
try:
if UIColor is not None:
back_btn.native_instance.setBackgroundColor_(UIColor.systemBlueColor())
back_btn.native_instance.setTitleColor_forState_(UIColor.whiteColor(), 0)
except Exception:
pass
back_btn.set_on_click(lambda: self.pop())
stack.add_view(back_btn)
self.set_root_view(stack)