button_documentation.py 644 B

1234567891011121314151617181920212223
  1. from nicegui import ui
  2. from ..documentation_tools import text_demo
  3. def main_demo() -> None:
  4. ui.button('Click me!', on_click=lambda: ui.notify(f'You clicked me!'))
  5. def more() -> None:
  6. @text_demo('Await button click', '''
  7. Sometimes it is convenient to wait for a button click before continuing the execution.
  8. ''')
  9. async def await_button_click() -> None:
  10. # @ui.page('/')
  11. # async def index():
  12. b = ui.button('Step')
  13. await b.clicked()
  14. ui.label('One')
  15. await b.clicked()
  16. ui.label('Two')
  17. await b.clicked()
  18. ui.label('Three')