main.py 722 B

1234567891011121314151617181920
  1. from nicegui import ui
  2. @ui.page('/subpage')
  3. def subpage():
  4. ui.label('This is a subpage').classes('text-h5 mx-auto mt-12')
  5. # TODO: this is not working properly yet
  6. # ui.button('back', on_click=lambda: ui.open('/')).classes('mx-auto')
  7. @ui.page('/')
  8. def index():
  9. with ui.card().classes('mx-auto px-24 pt-12 pb-24 items-center text-center'):
  10. ui.label('This demonstrates hosting of a NiceGUI app on a subpath.').classes('text-h5')
  11. ui.label('As you can see the entire app is available below "/nicegui".').classes('text-lg')
  12. ui.label('But the code here does not need to know that.').classes('text-lg')
  13. ui.link('Navigate to a subpage.', 'subpage').classes('text-lg')
  14. ui.run()