File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\libs\canvas.py", line 510, in paintEvent shape.paint(p) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\libs\shape.py", line 131, in paint painter.drawText(min_x, min_y, self.label) TypeError: arguments did not match any overloaded call: drawText(self, p: Union[QPointF, QPoint], s: str): argument 1 has unexpected type 'float' drawText(self, rectangle: QRectF, flags: int, text: str): argument 1 has unexpected type 'float' drawText(self, rectangle: QRect, flags: int, text: str): argument 1 has unexpected type 'float' drawText(self, rectangle: QRectF, text: str, option: QTextOption = QTextOption()): argument 1 has unexpected type 'float' drawText(self, p: QPoint, s: str): argument 1 has unexpected type 'float' drawText(self, x: int, y: int, width: int, height: int, flags: int, text: str): argument 1 has unexpected type 'float' drawText(self, x: int, y: int, s: str): argument 1 has unexpected type 'float' (venv) PS C:\Users\Administrator\PycharmProjects\pythonProject>
时间: 2024-04-22 07:25:29 浏览: 13
这个错误是由于在绘制形状时使用了无效的参数类型引起的。根据错误信息,绘图函数drawText()期望的第一个参数是一个整数类型,但实际上传递了一个浮点数类型。请检查你的代码,确保在调用drawText()函数时,第一个参数是一个整数值,而不是一个浮点数。你可以尝试使用int()函数将浮点数转换为整数,或者检查传递给drawText()函数的参数是否正确。