如何使这个 python GUI 运行 这个可执行文件?

How do I make this python GUI run this executable?

我正在尝试制作一个基本的 gui 菜单选项,它将 运行 我声明的 exe (hurl),但它不会。这是我的代码:

from tkinter import *
import os
root = Tk()
root.geometry('350x150')
root.title("hurler")
photo = PhotoImage(file = "Logo_Image.png")
root.iconphoto(False, photo)

entry_text = Label(text = "Number of posts you wish to automate (between 1-12) * ")

entry_text.place(x = 15, y = 10)

num = StringVar()

time_entry = Entry(textvariable = num, width = "10")

time_entry.place(x = 15, y = 40)

def action():
    if num == '1':
        os.system(".\hurl\hurl.exe")

register = Button(root,text = "Make", width = "10", height = "2", command = action, bg = "lightblue")
register.place(x = 15, y = 70)

root.mainloop()

我在这方面不是最有经验的,所以任何反馈都会有所帮助。

如何获得 运行 此 exe 的选项 1?谢谢

所以这些是改进,现在应该可以工作了:

from tkinter import *
import os
root = Tk()
root.geometry('350x150')
root.title("hurler")
# photo = PhotoImage(file = "Logo_Image.png")
# root.iconphoto(False, photo)

entry_text = Label(text = "Number of posts you wish to automate (between 1-12) * ")

entry_text.place(x = 15, y = 10)

num = StringVar()

time_entry = Entry(textvariable = num, width = "10")

time_entry.place(x = 15, y = 40)

def action():
    global num
    num = num.get()
    if num == '1':
        os.startfile('https://www.google.com')
    num = StringVar()

register = Button(root,text = "Make", width = "10", height = "2", command = action, bg = "lightblue")
register.place(x = 15, y = 70)

root.mainloop()

此处进行了更改:

def action():
    global num
    num = num.get()
    if num == '1':
        os.startfile('https://www.google.com')
    num = StringVar()

也应该与 os.system 东西一起工作