File tree Expand file tree Collapse file tree 3 files changed +79
-27
lines changed
apps/pythonnative_demo/app Expand file tree Collapse file tree 3 files changed +79
-27
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ import pythonnative as pn
2+
3+
4+ class MainPage (pn .Page ):
5+ def __init__ (self , native_instance ):
6+ super ().__init__ (native_instance )
7+
8+ def on_create (self ):
9+ super ().on_create ()
10+ stack_view = pn .StackView (self .native_instance )
11+ # list_data = ["item_{}".format(i) for i in range(100)]
12+ # list_view = pn.ListView(self.native_instance, list_data)
13+ # stack_view.add_view(list_view)
14+ button = pn .Button (self .native_instance , "Button" )
15+ button .set_on_click (lambda : self .navigate_to ("" ))
16+ # button.set_on_click(lambda: print("Button was clicked!"))
17+ stack_view .add_view (button )
18+ self .set_root_view (stack_view )
19+
20+ def on_start (self ):
21+ super ().on_start ()
22+
23+ def on_resume (self ):
24+ super ().on_resume ()
25+
26+ def on_pause (self ):
27+ super ().on_pause ()
28+
29+ def on_stop (self ):
30+ super ().on_stop ()
31+
32+ def on_destroy (self ):
33+ super ().on_destroy ()
34+
35+ def on_restart (self ):
36+ super ().on_restart ()
37+
38+ def on_save_instance_state (self ):
39+ super ().on_save_instance_state ()
40+
41+ def on_restore_instance_state (self ):
42+ super ().on_restore_instance_state ()
Original file line number Diff line number Diff line change 1+ import pythonnative as pn
2+
3+
4+ class SecondPage (pn .Page ):
5+ def __init__ (self , native_instance ):
6+ super ().__init__ (native_instance )
7+
8+ def on_create (self ):
9+ super ().on_create ()
10+ stack_view = pn .StackView (self .native_instance )
11+ label = pn .Label (self .native_instance , "Second page!" )
12+ stack_view .add_view (label )
13+ self .set_root_view (stack_view )
14+
15+ def on_start (self ):
16+ super ().on_start ()
17+
18+ def on_resume (self ):
19+ super ().on_resume ()
20+
21+ def on_pause (self ):
22+ super ().on_pause ()
23+
24+ def on_stop (self ):
25+ super ().on_stop ()
26+
27+ def on_destroy (self ):
28+ super ().on_destroy ()
29+
30+ def on_restart (self ):
31+ super ().on_restart ()
32+
33+ def on_save_instance_state (self ):
34+ super ().on_save_instance_state ()
35+
36+ def on_restore_instance_state (self ):
37+ super ().on_restore_instance_state ()
You can’t perform that action at this time.
0 commit comments