Ver Fonte

demonstrate passing input text to script executor

Rodja Trappe há 1 ano atrás
pai
commit
6e41af5add
1 ficheiros alterados com 2 adições e 2 exclusões
  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")