我创建了一些 python 脚本,我必须每隔一段时间运行一次,但现在我必须不断地键入或搜索脚本的位置才能执行它。我一直在寻找简单的软件来创建带有按钮的应用程序,但没有成功。
我也看到了“python?”带有一个界面的脚本,您可以在其中使用箭头键选择选项,但为此我还没有找到它是如何完成的。
有谁知道我如何制作其中一个我可以打开界面并选择我要执行的脚本?这真的会节省我很多时间。请您参考如下方法:
您可以 Tkinter创建 GUI,并为每个按钮创建一个运行 python 脚本的函数,如下所示:
# Create the button
button1 = Button \
(root, text='Start script1!', command=lambda: script1())
def script1():
os.system('python ~/path/to/script1.py')
def script2():
os.system('python ~/path/to/script2.py')
