我不确定我是否理解Python中多线程的概念。我想同时调用函数“plotpsd”两次,所以我这样做:
class Plotpsd:
def plotpsd(self, object):
samples = object.read_samples(1024)
[Y,F]=psd(samples, NFFT=1024, Fs=2.4e6/1e6, Fc=43000000/1e6, noverlap=0)
if __name__ == '__main__':
devs= [object1, object2]
pool = ThreadPool(4)
p=Plotpsd()
pool.map(p.plotpsd, devs)
pool.close()
pool.join()
object.close()
我收到此错误:
self.tk.call(('image','create',imgtype,name,)+ options) RuntimeError:主线程不在主循环中
我做错了什么?