PPOCRLabel报错:TypeError: setValue(self, a0: int): argument 1 has unexpected type ‘float’
**描述:**使用PPOCRLabel标注矩形框时,报错:
Traceback (most recent call last):
File "D:\work\code\venv\PaddleOCR\lib\site-packages\PPOCRLabel\PPOCRLabel.py", line 1425, in scrollRequest
bar.setValue(bar.value() + bar.singleStep() * units)
TypeError: setValue(self, a0: int): argument 1 has unexpected type 'float'
解决方法:
进入"site-packages\PPOCRLabel\libs\canvas.py",文件下,修改
#p.drawRect(leftTop.x(), leftTop.y(), rectWidth, rectHeight)
p.drawRect(int(leftTop.x()), int(leftTop.y()), int(rectWidth), int(rectHeight))
#p.drawLine(int(self.prevPoint.x()), 0, int(self.prevPoint.x()), self.pixmap.height())
#p.drawLine(0, int(self.prevPoint.y()), self.pixmap.width(), int(self.prevPoint.y()))
p.drawLine(int(self.prevPoint.x()), 0, int(self.prevPoint.x()), int(self.pixmap.height()))
p.drawLine(0, int(self.prevPoint.y()), int(self.pixmap.width()), int(self.prevPoint.y()))