main.py 633 B

1234567891011121314151617181920212223
  1. #!/usr/bin/env python3
  2. import example_c
  3. import example_pages
  4. import home_page
  5. import theme
  6. from nicegui import app, ui
  7. # here we use our custom page decorator directly and just put the content creation into a separate function
  8. @ui.page('/')
  9. def index_page() -> None:
  10. with theme.frame('Homepage'):
  11. home_page.content()
  12. # this call shows that you can also move the whole page creation into a separate file
  13. example_pages.create()
  14. # we can also use the APIRouter as described in https://nicegui.io/documentation/page#modularize_with_apirouter
  15. app.include_router(example_c.router)
  16. ui.run(title='Modularization Example')