我正在制作一个 python 接口来在 C 中运行一个程序,我需要知道这个 C 程序是否成功结束,但是我知道这样做的唯一方法是在 C 程序未完成时锁定接口。有谁知道我如何在不阻塞界面的情况下做到这一点?
下面是代码片段:
def runProg(self):
"""This funcion will run the simulation"""
if self.openned.get() == 1:
self.pid = StringVar()
a = open(self.nameFile.get(),"w")
self.writeFile()
self.process = subprocess.Popen([self.cmdSys.get()+self.dV.get()+
self.extension.get(),self.nameFile.get()])
self.pid = self.process.pid
#isso trava a interface para processos muito grandes até que o mesmo tenha terminado
if self.process.wait() == 0:
tkMessageBox.showinfo("","Your simulation was completed sucessfully.")