pyqt5绘制坐标系
pyqt5绘制坐标系
def paintEvent(self, event): painter = QPainter() painter.begin(self) # 绘制图像 image = self.pix if image.width()>0: rect = QRect(0, 0, image.width(), image.height()) painter.drawImage(rect, image) if self.is_draw_origin_point: point_pen = QPen(QColor(220,0,0),10) painter.setPen(point_pen) painter.drawPoint(self.origin_x,self.origin_y) if self.is_draw_vectorX_point: point_pen_x = QPen(self.x_color,10) painter.setPen(point_pen_x) painter.drawPoint(self.vectorX_x,self.vectorX_y) if self.is_draw_vectorY_point: point_pen = QPen(self.y_color,10) painter.setPen(point_pen) painter.drawPoint(self.vectorY_x,self.vectorY_y) if self.is_draw_axis: point_pen_x = QPen(self.x_color,5) painter.setPen(point_pen_x) painter.drawLine(self.origin_x,self.origin_y,self.vectorX_x,self.vectorX_y) painter.drawLine(self.vectorX_x-10,self.vectorX_y-10,self.vectorX_x,self.vectorX_y) painter.drawLine(self.vectorX_x-10,self.vectorX_y+10,self.vectorX_x,self.vectorX_y) point_pen_y = QPen(self.y_color,5) painter.setPen(point_pen_y) painter.drawLine(self.origin_x,self.origin_y,self.vectorY_x,self.vectorY_y) painter.drawLine(self.vectorY_x-10,self.vectorY_y-10,self.vectorY_x,self.vectorY_y) painter.drawLine(self.vectorY_x+10,self.vectorY_y-10,self.vectorY_x,self.vectorY_y)
#######################
QQ 3087438119