在函数启动时初始化新类时出错

时间:2018-12-07 00:06:52

标签: python tkinter multiprocessing

为什么说在代码中没有参数时缺少参数?

''

** Consol输出**

在输出中说缺少1,但这不是真的。

它不依赖于IDE

if correct:
            listOfCities = rmg.genRandomListOfPoints(self.numOfPointsVal,800,400)
            for algoType, isChoosen in self.checkBoxDict.items():
                if isChoosen.get():
                    print(algoType)
                    p = mp.Process(target = self.run(listOfCities,  self.numOfPointsVal, algoType))
                    p.start()
            # close this windows, it is longer no necessary
            self.destroy()
#-------------------------------------------------------------------------------------
    def run(self, listOfCities, numOfPointsVal, algoType):
        """ Starts other window from new process"""
        t =  InitFrame.__init__(listOfCities, numOfPointsVal , algoType)

1 个答案:

答案 0 :(得分:3)

要创建对象,您不应这样做:

t =  InitFrame.__init__(listOfCities,  self.numOfPointsVal, algoType)

但是:

t =  InitFrame(listOfCities,  self.numOfPointsVal, algoType)

(引发错误,因为当使用类名InitFrame.method()调用方法时,没有任何内容传递给self参数)

相关问题