I'm currently writing a program in python w开发者_JAVA百科ith a gui using wxpython. The program has a function which evaluates several pythonscripts and will therefore hang up the gui. I am trying to use a separate process for this function. The problem is that the function needs a few things from the ui; a listctrl and a textctrl, to update the information about the scripts that have been run. The following error is received when trying to pass wxpython objects to the process
PicklingError: Can't pickle <type 'PySwigObject'>: attribute lookup __builtin__.PySwigObject failed
Method that creates and starts the process:
def CreateProcess():
q = Queue()
q.put(gui.caselist)
q.put(gui.textlog)
p = Process(target=runScripts, args=(q,))
p.start()
Part of the method that is being ran by the process:
def runScripts(q):
caselist = q.get()
text = q.get()
Basically, you can't. You need to pass the results back and let the GUI thread update the listctrl and textctrl.
See this mailing list thread for information about the pickling error.
加载中,请稍侯......
精彩评论