這是我的代碼,謝謝大家。
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()
uj5u.com熱心網友回復:
如果您不使用--image并且--archive在手動運行命令時,則此處不需要它們。
只需True在串列中添加另一個引數即可。
def run_face_recognition(self):
subprocess.run([sys.executable, "main.py", self.image, self.archive, "True"])
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/474314.html
