def paint(self, painter: QPainter, styleOption: QStyleOptionGraphicsItem, widget: QWidget=None): pen = QPen() pen.setWidthF(0.05) pen.setColor(Qt.darkGray) painter.setPen(pen) brush = QBrush() brush.setColor(self.color) brush.setStyle(Qt.SolidPattern) painter.setBrush(brush) topLeft = QPointF(0, 0) bottomRight = QPointF(1, 1) rectangle = QRectF(topLeft, bottomRight) rectangle.translate(-0.5, -0.5) painter.drawRect(rectangle)
def __init__(self, boxManager): super().__init__() # Variables self.message = '' self.imageData = None self.boxes = [] self.drawingRect = None self.drawing = False # Objects self.image = None self.messageResetTimer = QTimer() self.brush = QBrush() self.pen = QPen() self.font = QFont('Arial', 8) self.boxManager = boxManager # Styling self.setMinimumSize(QSize(850, 725)) self.messageResetTimer.setInterval(3000) self.messageResetTimer.setSingleShot(True) # Connections self.messageResetTimer.timeout.connect(self.resetMessage)
def paint(self, painter: QPainter, option: QStyleOptionGraphicsItem, widget: QWidget) -> None: """ Paints a port. This function is used implicitly by the QGraphicsView to render a port. :param painter: The painter to paint with. :type painter: QPainter :param option: provides style options for the item. :type option: QStyleOptionGraphicsItem :param widget: QWidget :type widget: It points to the widget that is being painted on; or make it = None. :return: None :rtype: NoneType """ pen = QPen(PortGraphics.PEN_COLOR) pen.setWidth(self.borderWidth) painter.setPen(pen) if type(self._port.getAction()) == ActionWrapper: painter.setBrush(PortGraphics.INNER_COLOR) else: painter.setBrush(PortGraphics.OUTER_COLOR) painter.drawPath(self.shape())
def __init__(self, parent, config): super(Bar_Horizontal, self).__init__(parent) self.config = config self.value = config["min"] self.font = QFont() self.note_font = QFont() self.color = QColor(config["color"]) self.red_color = QColor(config["redline_color"]) self.no_color = QColor() self.no_color.setAlpha(0) self.brush = QBrush(self.color) self.red_brush = QBrush(self.red_color) self.pen = QPen(self.color) self.red_pen = QPen(self.red_color) self.no_pen = QPen(self.no_color) self.font.setPixelSize(self.config["font_size"]) self.note_font.setPixelSize(self.config["note_font_size"]) self.pen.setWidth(3) self.red_pen.setWidth(3)
def paintEvent(self, event): p = QPainter(self) p.setPen(QPen(self.pen_color)) p.drawLine(490, 70, 490, 110) # 1-2 p.drawLine(490, 160, 490, 200) # 2-3 p.drawLine(490, 250, 490, 290) # 3-4 p.drawLine(490, 340, 490, 380) # 4-5 p.drawLine(490, 430, 490, 470) # 5-6 p.drawLine(590, 405, 630, 405) # 5-4 p.drawLine(630, 405, 630, 315) # 5-4 p.drawLine(630, 315, 590, 315) # 5-4 self.update()
def test_simple_dashes_offset(self, p, opd): pen = QPen() pen.setDashPattern([2, 1]) pen.setDashOffset(1) pen.setWidth(5) p.setPen(pen) path = QPainterPath() path.moveTo(0, 0) path.lineTo(30, 0) p.drawPath(path) assert opd.getOutlines() == [ ((0.0, 0.0, 0.0, 1.0), 0.5, [(0.0, 0.0), (0.5, 0.0)]), ((0.0, 0.0, 0.0, 1.0), 0.5, [(1.0, 0.0), (2.0, 0.0)]), ((0.0, 0.0, 0.0, 1.0), 0.5, [(2.5, 0.0), (3.0, 0.0)]), ]
def toggle_attached(self): legend = self.chart.legend() if legend.isAttachedToChart(): legend.detachFromChart() legend.setBackgroundVisible(True) legend.setBrush(QBrush(QColor(128, 128, 128, 128))) legend.setPen(QPen(QColor(192, 192, 192, 192))) self.show_legend_spinbox() self.update_legend_layout() else: legend.attachToChart() legend.setBackgroundVisible(False) self.hideLegendSpinbox() self.update()
def paint(self, painter, option, widget): lod = option.levelOfDetailFromTransform(painter.worldTransform()) should_highlight = self._should_highlight() if should_highlight: pen = QPen(QColor(0, 0xfe, 0xfe), 2, self.style) else: pen = QPen(self.color, 2, self.style) painter.setPen(pen) painter.drawPath(self.path) # arrow if lod < 0.3: return # arrow if should_highlight: brush = QBrush(QColor(0, 0xfe, 0xfe)) else: brush = QBrush(self.color) painter.setBrush(brush) painter.drawPolygon(self.arrow)
def paint(self, painter=QPainter, option=QStyleOptionGraphicsItem, widget=QWidget): corners = 5 body = self.boundingRect() height = body.height() width = body.width() percentage = height / 10 painter.setRenderHint(QPainter.Antialiasing) path = QPainterPath() path.addRoundedRect(body, corners, corners) pen = QPen(QColor(255, 255, 255, 100), 3) if self.hover and not self.isPressed else QPen( Qt.black, 0.1) pen.setJoinStyle(Qt.RoundJoin) pen.setCosmetic(True) painter.setPen(pen) painter.fillPath(path, self._model["bgColor"]) painter.drawPath(path) if not self.isPressed: grad = QLinearGradient(0, height, 0, height - percentage) grad.setColorAt(0, QColor(175, 175, 175, 255)) grad.setColorAt(1, QColor(175, 175, 175, 0)) path = QPainterPath() path.addRoundedRect(body, corners, corners) painter.setCompositionMode(QPainter.CompositionMode_Multiply) painter.setPen(Qt.NoPen) painter.fillPath(path, grad) painter.drawPath(path) grad = QLinearGradient(0, percentage, 0, 0) grad.setColorAt(1, QColor(255, 255, 255, 255)) grad.setColorAt(0, QColor(255, 255, 255, 0)) path = QPainterPath() path.addRoundedRect(body, corners, corners) painter.setCompositionMode(QPainter.CompositionMode_Overlay) painter.setPen(Qt.NoPen) painter.fillPath(path, grad) painter.drawPath(path) painter.setCompositionMode(QPainter.CompositionMode_Source) else: path = QPainterPath() path.addRoundedRect(body, corners, corners) painter.setCompositionMode(QPainter.CompositionMode_Overlay) painter.setPen(Qt.NoPen) painter.fillPath(path, QColor(255, 255, 255)) painter.drawPath(path) painter.setCompositionMode(QPainter.CompositionMode_Source) super(ButtonNode, self).paint(painter, option, widget)
def paintEvent(self, e): painter = QPainter(self) painter.setPen(QPen(Qt.black, 2, Qt.DashDotLine)) painter.setBrush(QBrush(Qt.green, Qt.DiagCrossPattern)) painter.drawEllipse(100, 100, 400, 200) painter.drawRect(200, 150, 400, 200) points = QPolygon([ QPoint(10, 10), QPoint(10, 100), QPoint(100, 10), QPoint(100, 80) ]) painter.drawPolygon(points)
def paintWithoutNotation(self, painter): brushBackup = painter.brush() penBackup = painter.pen() localPen = QPen(self._lineColor) localPen.setWidth(self._lineWidth) painter.setPen(localPen) painter.drawEllipse(self._borderOffset, self._borderOffset, self._radius * 2, self._radius * 2) if self._scale == 0 or len(self._digitsList) == 0: return for i in range(1, len(self._digitsList)): prevDigit = self._digitsList[i - 1] currentDigit = self._digitsList[i] self.drawLine(painter, prevDigit, currentDigit) if self._cycleFlag: firstDigit = self._digitsList[0] lastDigit = self._digitsList[-1] self.drawLine(painter, lastDigit, firstDigit) painter.setBrush(self._dotColor) painter.drawEllipse( self._radius - self._posX + self._borderOffset - 10 / 2, self._radius - self._posY + self._borderOffset - 10 / 2, 10, 10) painter.setBrush(brushBackup) painter.setPen(penBackup)
def paint(self, painter, option, widget=None): painter.setBrush(Qt.NoBrush) c = '' if Design.flow_style == 'dark std': c = '#ffffff' elif Design.flow_style == 'dark tron': if self.parent_port_instance.type_ == 'exec': c = '#ffffff' elif self.parent_port_instance.type_ == 'data': c = self.parent_node_instance.parent_node.color pen = QPen(c) painter.setPen(pen) painter.setFont(self.font) painter.drawText(self.boundingRect(), Qt.AlignCenter, self.parent_port_instance.label_str)
def __init__(self, name, flow_conn_exec_color, flow_conn_exec_width, flow_conn_exec_pen_style, flow_conn_data_color, flow_conn_data_width, flow_conn_data_pen_style, node_instance_painter, flow_background_color=QColor('#333333')): self.name = name self.node_inst_painter = node_instance_painter self.flow_conn_exec_pen = QPen(flow_conn_exec_color, flow_conn_exec_width) self.flow_conn_exec_pen.setStyle(flow_conn_exec_pen_style) self.flow_conn_exec_pen.setCapStyle(Qt.RoundCap) self.flow_conn_data_pen = QPen(flow_conn_data_color, flow_conn_data_width) self.flow_conn_data_pen.setStyle(flow_conn_data_pen_style) self.flow_conn_data_pen.setCapStyle(Qt.RoundCap) self.flow_background_color = flow_background_color
def paintEvent(self, e): painter = QPainter(self) painter.setPen(QPen(Qt.blue, 7, Qt.DashDotLine)) painter.setBrush(QBrush(Qt.green, Qt.SolidPattern)) painter.drawEllipse(100, 100, 400, 200) points = QPolygon([ QPoint(10, 10), QPoint(10, 100), QPoint(100, 100), QPoint(100, 10), ]) painter.drawPolygon(points)
def paintEvent(self, event): self.points = [] painter = QtGui.QPainter(self) painter.fillRect(self.rect(), QColor(80, 80, 80)) painter.setRenderHint(QtGui.QPainter.Antialiasing, True) self.pathtracer.paint(painter) txt = "max bounces: {} | scatter per bounce: {}".format( self.pathtracer.max_bounces, self.pathtracer.scatter_per_bounce) painter.fillRect(10, 10, 220, 15, QColor(150, 150, 150)) painter.setPen(QPen()) painter.drawText(20, 20, txt)
def paintEvent(self, QPaintEvent): painter = QPainter() painter.begin(self) painter.setPen(Qt.NoPen) painter.fillRect(self.rect(), QColor(190, 190, 190, 255)) if self.label_img: if self.mouse_press_flag and self.mouse_pos: pp = QPainter(self.mask_img) if self.eraser_painting_model: pp.setPen( QPen(self.eraser_color, self.eraser_pixle_size, Qt.SolidLine, Qt.RoundCap, Qt.BevelJoin)) else: pp.setPen( QPen(self.brush_color, self.brush_pixle_size, Qt.SolidLine, Qt.RoundCap, Qt.BevelJoin)) pp.drawPoint(self.mouse_pos - self.img_rect.topLeft()) result_pixmap = self.join_pixmap(self.label_img, self.mask_img) painter.drawPixmap(self.img_rect, result_pixmap) painter.end()
def paintEvent(self, event): painter = QPainter() painter.setRenderHint(painter.Antialiasing) # painter.setRenderHint(painter.HighQualityAnti) painter.begin(self) print 'paint something', event # path = QPainterPath() painter.setPen(QPen(Qt.yellow, 5)) painter.drawEllipse(50, 50, 50, 50) painter.end()
def paint(self, painter, option, widget): #pylint: disable=unused-argument """ Paint a state block on the scene. :param painter: :return: None """ painter.setFont(Conf.symexec_font) normal_background = QColor(0xfa, 0xfa, 0xfa) selected_background = QColor(0xcc, 0xcc, 0xcc) # The node background if self.selected: painter.setBrush(selected_background) else: painter.setBrush(normal_background) painter.setPen(QPen(QColor(0xf0, 0xf0, 0xf0), 1.5)) painter.drawRect(0, 0, self.width, self.height) x = 0 y = 0 x += self.HORIZONTAL_PADDING y += self.VERTICAL_PADDING # definition painter.setPen(Qt.darkBlue) painter.drawText(x, y + self._config.symexec_font_ascent, self._definition_str) y += self._config.symexec_font_height + self.LINE_MARGIN # The instruction x = 0 addr_label_x = x + self.HORIZONTAL_PADDING painter.setPen(Qt.black) painter.drawText(addr_label_x, y + self._config.symexec_font_ascent, self._instruction_str) x = addr_label_x + self._config.symexec_font_metrics.width(self._instruction_str) # The text if self._text: x += 10 text_label_x = x painter.setPen(Qt.gray) painter.drawText(text_label_x, y + self._config.symexec_font_ascent, self._text) painter.setPen(Qt.black) y += self._config.symexec_font_height + self.LINE_MARGIN x = 0
def paintEvent(self, e): """ Draws the color bar and arrow """ if self.item(): painter = QPainter(self) # Draws the color bar painter.setPen(Qt.NoPen) rect = QRect(0, 0, self.COLOR_BAR_WIDTH, self.COLOR_BAR_HEIGHT) painter.fillRect(rect, self.item().data(renderSetupRoles.NODE_COLOR_BAR)) oldBrush = painter.brush() if self.item().type( ) == renderSetup.RENDER_OVERRIDE_TYPE and self.item( ).isLocalRender(): diameter = rect.width() - 2 rect2 = QRect(rect.x() + 1, rect.y() + (rect.height() - diameter) / 2, diameter, diameter) brush = painter.brush() pen = painter.pen() hints = painter.renderHints() painter.setRenderHint(QPainter.Antialiasing, on=True) painter.setPen(Qt.NoPen) painter.setBrush( QBrush(QColor(67, 79, 70), style=Qt.SolidPattern)) painter.drawEllipse(rect2) painter.setRenderHints(hints) painter.setPen(pen) painter.setBrush(brush) # Draws the arrow painter.setBrush(self.ARROW_COLOR) if self.arrowPoints == BaseDelegate.EXPANDED_ARROW: painter.translate(self.EXPANDED_ARROW_OFFSET, 0.0) else: painter.translate(self.COLLAPSED_ARROW_OFFSET, 0.0) painter.drawPolygon(self.arrowPoints) painter.setBrush(oldBrush) # Draws the node type text painter.setPen(QPen(self.item().data(Qt.TextColorRole))) text = self.item().data(renderSetupRoles.NODE_TYPE_STR) painter.setFont(self.item().data(Qt.FontRole)) painter.drawText(self.NODE_TYPE_TEXT_RECT, text, QTextOption(Qt.AlignLeft | Qt.AlignVCenter))
def draw(cls, x, y, self: PreparedLine, painter: QPainter): old_pen = painter.pen() pen = QPen(QColor(0)) pen.setWidth(self.size) pen.setStyle(Qt.PenStyle.SolidLine) painter.setPen(pen) tx = self.left + x ty = self.top + y painter.drawLine(QLine(tx, ty, tx + self.width, ty + self.height)) painter.setPen(old_pen)
def selectTile(self, x, y): pen = QPen() pen.setColor(QColor(0x00, 0x32, 0x32, 0x60)) pen.setWidth(4) new_x, new_y = self.findTilePos(x, y) selection_rect = QRect(new_x, new_y, self._tile_w, self._tile_h) if self._selection_rect is not None: self._scene.removeItem(self._selection_rect) self._selection_rect = self._scene.addRect(selection_rect, pen)
def paint_labels(self, painter, x0, y0, radius, labels): steps = len(labels) radius = radius + 0.11 for n in range(steps): phi = 2.0 * self.pi * n / steps + 0.5 * 2.0 * self.pi / steps x1 = x0 + radius * numpy.cos(phi) - 0.09 y1 = y0 + radius * numpy.sin(phi) + 0.05 xt, yt = self.convert_position(x1, y1) text = str(labels[n]) painter.setPen(QPen(self.text_color, 2, Qt.SolidLine)) painter.drawText(xt, yt, text)
def show_points(self, points): painter = QPainter(self.label.pixmap()) painter.setRenderHint(QPainter.Antialiasing) painter.setPen(Qt.NoPen) painter.setBrush(QColor('#0C1C23')) painter.drawRect(self.rect()) pen = QPen(QColor('#ffffff')) painter.setPen(pen) painter.setBrush(QBrush(QColor('#ffffff'))) for p in points: painter.drawEllipse(p[0]*self.label.pixmap().width(), p[1]*self.label.pixmap().height(), 2, 2) self.repaint()
def update_text(self): self.key = self.keys[self.index] if not self.text_over_mouse: return color = self.colors[self.index] line_color = QColor(color[0], color[1], color[2], color[3]) face_color = QColor(color[0], color[1], color[2], int(color[3] * 0.3)) pen = QPen(line_color, 0.5, Qt.SolidLine, Qt.FlatCap, Qt.MiterJoin) brush = QBrush(face_color) if self.text is None: self.text = QtWidgets.QGraphicsSimpleTextItem(self.key) self.scene.addItem(self.text) self.text.setText(self.key) self.text.setBrush(brush) self.text.setPen(pen)
def __init__(self, element, path): super().__init__(element) self.path = path self.setPen(QPen(Qt.black, 2)) self.setBrush(Qt.white) self.setRect(QRectF(QPoint(), self._SIZE)) self.setFlag(QGraphicsItem.ItemIsSelectable) def _update_pin(): lit = element.simulator.get_pin_value(path) > 0 self.setBrush(Qt.green if lit else Qt.white) self.update() element.simulator.observe(path, _update_pin)
def paint(self, painter: QPainter, option: QStyleOptionGraphicsItem, widget=None): painter.setPen(QPen(Qt.black, self.model.common_model.line_thickness)) monitor = self.model.monitor painter.drawLine(0, self._glob_h_over_mid_line, self._h_line_length, self._glob_h_over_mid_line) painter.drawLine(monitor.screen_width, self._glob_h_over_mid_line, monitor.screen_width - self._h_line_length, self._glob_h_over_mid_line) painter.drawLine(0, self._glob_h_mid_line, monitor.screen_width, self._glob_h_mid_line) painter.drawLine(0, self._glob_h_under_mid_line, self._h_line_length, self._glob_h_under_mid_line) painter.drawLine(monitor.screen_width, self._glob_h_under_mid_line, monitor.screen_width - self._h_line_length, self._glob_h_under_mid_line)
def drawEllipse(self, x1, x2, y1, y2, result): rect = self.selected_area.normalized() tmpRect = QRect(QPoint(x1, x2), QPoint(y1, y2)).normalized() resultRect = rect & tmpRect tmp = [ ACTION_ELLIPSE, resultRect.topLeft().x(), resultRect.topLeft().y(), resultRect.bottomRight().x(), resultRect.bottomRight().y(), QPen(QColor(self.penColorNow), int(self.penSizeNow)) ] if result: self.drawListResult.append(tmp) else: self.drawListProcess = tmp
def drawCircle(self, point): painter = QPainter(self.image) painter.setCompositionMode(QPainter.CompositionMode_Source) painter.setRenderHint(QPainter.Antialiasing) brush = QBrush(QColor(0, 0, 255, 255), Qt.SolidPattern) pen = QPen(brush, 0.2 * self.myPenWidth / self.scaleFactor, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin) painter.setPen(pen) radius = 1.5 * self.myPenWidth / self.scaleFactor rectangle = QRectF((point.x() / self.scaleFactor) - (radius / 2), (point.y() / self.scaleFactor) - (radius / 2), radius, radius) painter.drawEllipse(rectangle) self.update()
def __init__(self, data): super().__init__() self.data = data # Init all dictionnary self.curves = dict() self.curves["nb_lo"] = 0 self.curves["nb_gaus"] = 0 self.curves["nb_l"] = 0 self.curves["nb_exp"] = 0 self.curves["y_tot"] = np.asarray([0 for _ in range(len(data["x"]))]) self.pen_tot = QPen(Qt.red, 0.01) self.set_ui() self.show()
def movePerson(self, elipse, pos, size=100): #elipse.setPos(pos[0], pos[1]) pos = [pos[0], pos[2]] if len(pos) > 2 else pos color = elipse.pen().color() self.scene.addEllipse(pos[0] - size // 2, pos[1] - size // 2, size, size, pen=QPen(QColor(color), 20), brush=QBrush(color=QColor(color))) # pixmap self.persons[elipse].setPos(pos[0] - self.pixmapSize[0], pos[1] - self.pixmapSize[1]) # change rotation value when provided self.persons[elipse].setRotation(180)
def drawBg_TB(self, painter: QPainter) -> None: painter.save() # 圆半径为高度一定比例,计算宽度,将宽度等分 width: int = self.width() // self.__maxStep height: int = self.height() // 3 radius: int = height // 2 initX: int = width // 2 initY: int = self.height() // 2 # 逐个绘制连接线条 pen: QPen = QPen() pen.setWidthF(radius / 4) pen.setCapStyle(Qt.RoundCap) pen.setColor(self.__background) painter.setPen(pen) painter.setBrush(Qt.NoBrush) for i in range(self.__maxStep - 1): painter.drawLine(QPoint(initX, initY), QPoint(initX + width, initY)) initX += width # 逐个绘制圆 initX: int = width // 2 painter.setPen(Qt.NoPen) painter.setBrush(self.__background) for i in range(self.__maxStep): painter.drawEllipse(QPoint(initX, initY), radius, radius) initX += width # 逐个绘制圆中的数字 initX = width // 2 font: QFont = QFont() font.setPixelSize(radius) painter.setFont(font) painter.setPen(self.__foreground) painter.setBrush(Qt.NoBrush) for i in range(self.__maxStep): textRect: QRect = QRect(initX - radius, initY - radius, radius * 2, radius * 2) painter.drawText(textRect, Qt.AlignCenter, str(i + 1)) initX += width painter.restore()
def __init__(self, tetris: Tetris): super(QTetris.QScene, self).__init__() self.tetris = tetris pen = QPen() pen.setWidthF(0.05) pen.setColor(Qt.lightGray) brush = QBrush(Qt.NoBrush) rect = QRectF(0, 0, tetris.num_rows, tetris.num_columns) rect.translate(-0.5, -0.5) self.setSceneRect(rect) self.addRect(rect, pen, brush) self.setBackgroundBrush(self.palette().window()) for column in range(0, tetris.num_columns, 2): pen = QPen(Qt.NoPen) brush = QBrush(Qt.SolidPattern) brush.setColor(Qt.lightGray) topLeft = QPointF(0, column) bottomRight = QPointF(tetris.num_rows, column + 1) rectangle = QRectF(topLeft, bottomRight) rectangle.translate(-0.5, -0.5) self.addRect(rectangle, pen, brush)
def paintEvent(self, paintEvent: QPaintEvent): painter = QPainter(self) painter.setBackgroundMode(Qt.TransparentMode) painter.setRenderHint(QPainter.Antialiasing) brush = QBrush() brush.setStyle(Qt.SolidPattern) pen = QPen() pen.setJoinStyle(Qt.RoundJoin) pen.setCapStyle(Qt.RoundCap) center = QPoint(self.width() // 2, self.height() // 2) radius = 0.45 * min(self.width(), self.height()) pen.setColor(self.palette().color(self.color[0])) brush.setColor(self.palette().color(self.color[1])) if self.highlight is True: pen.setColor(self.palette().color(QPalette.Highlight)) pen.setWidth(round(0.15 * radius)) painter.setBrush(brush) painter.setPen(pen) painter.drawEllipse(center, radius, radius) if self.checked is True: brush.setColor(self.palette().color(QPalette.Background)) pen.setColor(self.palette().color(QPalette.Background)) painter.setPen(pen) painter.setBrush(brush) painter.drawEllipse(center, 0.40 * radius, 0.40 * radius) del painter, brush, pen
def paintEvent(self, paintEvent: QPaintEvent): pen = QPen() pen.setJoinStyle(Qt.RoundJoin) pen.setCapStyle(Qt.RoundCap) painter = QPainter(self) painter.translate(self.paintOffset) painter.setBackgroundMode(Qt.TransparentMode) painter.setRenderHint(QPainter.Antialiasing) if self.nodes is not None: painted = set() def paintNode(node): nonlocal painter, painted if node in painted: return painted.add(node) for link in node.links: if link not in painted: painter.drawLine(node.point, link.point) paintNode(link) color = self.palette().color(QPalette.Dark) pen.setColor(color) pen.setWidth(0.50 * self.paintStep) painter.setPen(pen) for node in self.nodes.values(): if paintEvent.region().contains(node.point): paintNode(node) if self.startNode is not None: color = self.palette().color(QPalette.Dark) pen.setColor(color) pen.setWidth(0.75 * self.paintStep) painter.setPen(pen) if paintEvent.region().contains(self.startNode.point): painter.drawPoint(self.startNode.point) if self.finishNode is not None and paintEvent.region().contains(self.finishNode.point): color = self.palette().color(QPalette.Dark).darker(120) pen.setColor(color) pen.setWidth(0.75 * self.paintStep) painter.setPen(pen) painter.drawPoint(self.finishNode.point) if self.player is not None: color = self.palette().color(QPalette.Highlight) color.setAlpha(196) pen.setColor(color) pen.setWidth(0.90 * self.paintStep) painter.setPen(pen) painter.drawPoint(self.player) del painter, pen