我正在尝试在更改特定变量的值时调用一个函数。我想过用它来绑定,但我不能让它工作。以下是相关的代码片段:
def runSim (self):
if self.openned.get() == 1:
self.p = multiprocessing.Process(target= self.runProg).start()
elif self.openned.get() == 0:
saveFirst = tkMessageBox.askokcancel("Warning",
"This is a new file. For run this, please save first")
if saveFirst:
self.saveAs()
self.openned.set(1)
self.p = multiprocessing.Process(target= self.runProg).start()
def runProg(self):
"""This funcion will run the simulation"""
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.set(self.process.pid)
if self.process.wait() is 0:
#here is the part where the function have to be called when the variable's values is changed!!!
def callMsg(self):
tkMessageBox.showinfo("","Your simulation was completed sucessfully.")
我怎样才能使用 BIND 来做到这一点?