|
@@ -29,11 +29,12 @@ async def run_command(command: str) -> None:
|
|
|
with ui.dialog() as dialog, ui.card():
|
|
|
result = ui.markdown()
|
|
|
|
|
|
-commands = ['python3 hello.py', 'python3 hello.py NiceGUI', 'python3 slow.py']
|
|
|
+ui.button('python3 hello.py', on_click=lambda: run_command('python3 hello.py')).props('no-caps')
|
|
|
+ui.button('python3 slow.py', on_click=lambda: run_command('python3 slow.py')).props('no-caps')
|
|
|
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}'))
|
|
|
+ ui.button('python3 hello.py "<message>"', on_click=lambda: run_command(f'python3 hello.py "{message.value}"')) \
|
|
|
+ .props('no-caps')
|
|
|
+ message = ui.input('message')
|
|
|
|
|
|
# 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")
|