Pyinstaller - exe做除Python脚本之外的其他事情

时间:2014-05-21 20:21:44

标签: python multithreading wxpython pyinstaller

我的pyinstaller和我的程序有问题。如果我启动我的脚本,一切都运行正确,但如果我运行exe,它会做一些奇怪的事情。

此代码应该在显示框架时执行某些操作,如果完成框架应该销毁。但是在exe中它并没有创建任何东西,但是在一段时间后创建了第二个主框架(在这个脚本中没有创建一个主框架,这只发生在wxpython应用程序中)。 下面是创建框架的代码:

# self is a wx.Frame
def handleInputs(self):
    path = self.setSavePath() # setSavePath just takes a path from a fileDialog
    if path:
        self.dialog = WaitingDialog() # subclass of wx.MiniFrame
        self.dialog.Show(True)
        calcThread = threading.Thread(target=self.doStuff)
        checkThread = threading.Thread(target=self.checkFinishing)
        calcThread.start()
        checkThread.start()
        self.Disable()

def checkFinishing(self, thread):
    while thread.is_alive():
        pass
    wx.CallAfter(self.closeFrame)
    return True

def doStuff(self):
    # do Stuff here
    return True

def closeFrame(self):
    self.dialog.Destroy()
    self.Destroy()

所以,调用self.handleInputs(),但在应用程序中,看起来doStuff()中没有任何操作,然后创建一个新的主框架。 你看到任何错误或知道为什么会这样吗?

1 个答案:

答案 0 :(得分:0)

现在解决了它,删除了多处理的所有用途。