main.py 740 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/usr/bin/env python3
  2. from router import Router
  3. from nicegui import ui
  4. router = Router()
  5. @router.add('/')
  6. async def show_one():
  7. ui.label('Content One').classes('text-2xl')
  8. @router.add('/two')
  9. async def show_two():
  10. ui.label('Content Two').classes('text-2xl')
  11. @router.add('/three')
  12. async def show_three():
  13. ui.label('Content Three').classes('text-2xl')
  14. with ui.row():
  15. ui.button('One', on_click=lambda: router.open(show_one)).classes('w-32')
  16. ui.button('Two', on_click=lambda: router.open(show_two)).classes('w-32')
  17. ui.button('Three', on_click=lambda: router.open(show_three)).classes('w-32')
  18. # this places the frame for the content which should be displayed
  19. router.frame().classes('w-full pt-8')
  20. ui.run()