download_documentation.py 442 B

123456789101112131415
  1. from nicegui import ui
  2. from ..tools import text_demo
  3. def main_demo() -> None:
  4. ui.button('Logo', on_click=lambda: ui.download('https://nicegui.io/logo.png'))
  5. def more() -> None:
  6. @text_demo('Download raw bytes from memory', '''
  7. The `download` function can also be used to download raw bytes from memory.
  8. ''')
  9. def raw_bytes():
  10. ui.button('Download', on_click=lambda: ui.download(b'Hello World', 'hello.txt'))