工作需要写一个自动截图小工具。但是运行后报2种错误:
1、Timers cannot be stopped from another thread
2、'Runthread' object has no attribute“run_stop”
怀疑是线程的使用方法问题,但是在CSDN及Stack Overflow上都没找到对应的办法。
最后使用排除法,把代码挨个删除,看看是否报错。最后发现,是__int__写错了!!!
class Runthread(QThread):
def __int__(self, parent=None):
super(Runthread, self).__init__()
self.pr = "a"
def run(self):
print(self.pr)