[英]Normally i run on command line : python main.py image/ archive/ True , so how can i run on tkinter gui
This is my code, Thanks everybody.这是我的代码,谢谢大家。
import subprocess
import sys
import tkinter as tk
import tkinter.filedialog
class Application(tk.Frame):
def __init__(self, master=None):
super().__init__(master)
self.master = master
self.pack()
self.create_widgets()
self.image = "image/"
self.archive = "archive/"
def create_widgets(self):
tk.Button(self, text="Run", command=self.run_face_recognition).pack(fill=tk.X)
tk.Button(self, text="Quit", command=self.master.destroy).pack(fill=tk.X)
def run_face_recognition(self):
subprocess.run([sys.executable, "main.py","--image/", "--archive/", self.image, self.archive, "args..."])
root = tk.Tk()
app = Application(master=root)
app.mainloop()
If you don't use --image
and --archive
when running the command by hand, you don't need them here.如果您在手动运行命令时不使用
--image
和--archive
,则此处不需要它们。
Just add True
as another argument in the list.只需在列表中添加
True
作为另一个参数。
def run_face_recognition(self):
subprocess.run([sys.executable, "main.py", self.image, self.archive, "True"])
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.