浏览代码

demonstrate passing input text to script executor

Rodja Trappe 1 年之前
父节点
当前提交
6e41af5add
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      examples/script_executor/main.py

+ 2 - 2
examples/script_executor/main.py

@@ -30,10 +30,10 @@ with ui.dialog() as dialog, ui.card():
     result = ui.markdown()
 
 commands = ['python3 hello.py', 'python3 hello.py NiceGUI', 'python3 slow.py']
-with ui.row():
+with ui.row().classes('items-center'):
     for command in commands:
         ui.button(command, on_click=lambda command=command: run_command(command)).props('no-caps')
-
+    message = ui.input('your message').on('keydown.enter', lambda: run_command(f'python3 hello.py {message.value}'))
 
 # NOTE on windows reload must be disabled to make asyncio.create_subprocess_exec work (see https://github.com/zauberzeug/nicegui/issues/486)
 ui.run(reload=platform.system() != "Windows")