def paintEvent(self, event): painter = QPainter(self) #painter.setPen(QtCore.Qt.black) #painter.translate(self.x(), self.y()) painter.rotate(self.angle) painter.drawPixmap(0, 0, self.width(), self.height(), self._pixmap) painter.end()
def paintEvent(self, event): painter = QPainter(self) # 描画の中心をWidgetの中心に持ってくる cx = float(self.width()) * 0.5 cy = float(self.height()) * 0.5 painter.translate(cx, cy) # これ以降にトランスとスケール操作を持ってくる painter.scale(self.scale.x(), self.scale.y()) painter.translate(self.trans + self.mouseTrans) if self.rotatingWorld == True: painter.rotate(-90) # これ以降に描きたいものを重ねていく self.drawField(painter) self.drawTargets(painter) self.drawAvoidPoints(painter) self.drawFriends(painter) self.drawEnemis(painter) self.drawBallVelocity(painter) self.drawBall(painter)
def paintEvent(self, event): painter = QPainter(self) # 描画の中心をWidgetの中心に持ってくる cx = float(self.width()) * 0.5 cy = float(self.height()) * 0.5 painter.translate(cx, cy) # これ以降にトランスとスケール操作を持ってくる painter.scale(self.scale.x(), self.scale.y()) painter.translate(self.trans + self.mouseTrans) if self._should_rotate_world == True: painter.rotate(-90) # これ以降に描きたいものを重ねていく self.drawField(painter) self.drawAvoidingPoints(painter) self.drawTargets(painter) self.drawFriends(painter) self.drawEnemis(painter) self.drawBallVelocity(painter) self.drawBall(painter) if self._is_ballpos_replacement or self._is_robotpos_replacement: self.drawPosReplacement(painter) self.drawCoordinateText(painter) elif self._is_ballvel_replacement: self.drawVelReplacement(painter) elif self._is_robotangle_replacement: self.drawAngleReplacement(painter) else: self.drawCoordinateText(painter)
def paintEvent(self, event): painter = QPainter(self) # 描画の中心をWidgetの中心に持ってくる cx = float(self.width()) * 0.5 cy = float(self.height()) * 0.5 painter.translate(cx, cy) painter.scale(self._scale.x(), self._scale.y()) painter.translate(self._trans + self._mouse_trans) if self._do_rotate_view is True: painter.rotate(-90) # これ以降に書きたいものを重ねる self._draw_field(painter) # Referee情報 self._draw_referee(painter) self._draw_ball(painter) self._draw_ball_velocity(painter) # JoyStick関連 if len(self._joy_target.path) > 0: self._draw_joy_target(painter) self._draw_robots(painter) # grSim Replacement関連 if self._replacement_target['ball_pos'] or self._replacement_target[ 'robot_pos']: self._draw_pos_replacement(painter) self._draw_cursor_coordinate(painter) elif self._replacement_target['ball_vel']: self._draw_vel_replacement(painter) elif self._replacement_target['robot_angle']: self._draw_angle_replacement(painter) else: self._draw_cursor_coordinate(painter)
def paintEvent(self, event): painter = QPainter(self) #painter.begin(self) # puts the arrow in the middle painter.translate(self.width() / 2, self.height() / 2) painter.rotate(self.angleRobo + self.angleVel) line = QLineF(0, 0, self.width() / 2 - 3, 0) headSize = min(self.width() / 20, 4) points = QPolygonF() points.append(QPointF(self.width() / 2 - headSize * 2, headSize)) points.append(QPointF(self.width() / 2 - headSize * 2, -headSize)) points.append(QPointF(self.width() / 2 - 3, 0)) pen = QPen(self.color, 2) painter.setPen(pen) brush = QBrush(self.color) painter.setBrush(brush) painter.drawLine(line) painter.drawConvexPolygon(points)