Connect/Process a script to PySimpleGUI button(将脚本连接/处理到 PySimpleGUI 按钮)
问题描述
你们能帮我知道如何在我的 PySimpleGui 脚本中连接一个按钮,当按下/单击运行按钮时,它将执行另一个 python 脚本.
can you guys help me to know how to connect a button in my PySimpleGui script which will execute another python script when the run button is pressed/clicked.
目前,我一直在阅读有关 Subprocess 和 command = os.popen 的 GUI 脚本.
For now, i've been reading about Subprocess and command = os.popen in a GUI script.
在我的 pysimplegui 脚本中,我还没有包含子进程或任何库,因为我只是不知道在哪里做.欢迎任何帮助!
In my pysimplegui script, i have not yet included the subprocess or any library because i just don't know where to do it. Any help will is most welcome!
推荐答案
这里是您问题的完整答案,一个 PySimpleGUI 程序.该程序允许您输入命令.然后按一个按钮.按下按钮时,命令为运行",输出显示在窗口中.
Here's a full answer to your question, a PySimpleGUI program. This program allows you to type in a command. Then press a button. When button pressed the command is "run" and the output is shown in the window.
这篇关于将脚本连接/处理到 PySimpleGUI 按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!