瀏覽代碼

add demo for #2050

Falko Schindler 1 年之前
父節點
當前提交
5fa191786f
共有 1 個文件被更改,包括 11 次插入1 次删除
  1. 11 1
      website/documentation/more/download_documentation.py

+ 11 - 1
website/documentation/more/download_documentation.py

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