| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- import PikaUI as ui
- from PikaStdLib import MemChecker as mem
- class Page1(ui.Page):
- def onclick_next(self, event):
- print('Page1: onclick_next')
- app.pageManager.enter(Page2())
- mem.now()
- def build(self):
- main = ui.Container(
- width=300,
- height=200,
- pos=(0, 50)
- ).add(
- ui.Text(
- text='Hello Page1',
- align=ui.ALIGN.CENTER
- ),
- ui.Button(
- text='Next',
- align=ui.ALIGN.CENTER,
- pos=(0, 50),
- height=30,
- width=80,
- onclick=self.onclick_next
- )
- )
- title = ui.Text("Title")
- return [main, title]
- class Page2(ui.Page):
- def on_click_back(self, event):
- app.pageManager.back()
- mem.now()
- def build(self):
- return ui.Container(
- width= 400,
- height= 200,
- pos=(0, 50)
- ).add(
- ui.Text(
- text='Hello Page2',
- align=ui.ALIGN.CENTER
- ),
- ui.Button(
- text='Back',
- align=ui.ALIGN.CENTER,
- pos=(0, 50),
- height=30,
- width=80,
- onclick=self.on_click_back
- )
- )
- app = ui.App()
- app.pageManager.enter(Page1())
- app.timer.cb(0)
- mem.now()
- app.pageManager.enter(Page2())
- app.timer.cb(0)
- mem.now()
- app.pageManager.back()
- app.timer.cb(0)
- mem.now()
- # for i in range(100):
- # app.pageManager.enter(Page2())
- # app.timer.cb(0)
- # mem.now()
- # app.pageManager.back()
- # app.timer.cb(0)
- # mem.now()
|