def paintEvent(self, e): Part.paintEvent(self, e) painter = QPainter(self) color = QColor(self._base) color.setAlpha(200) painter.setPen(color.dark(150)) painter.setBrush(color.dark(115)) painter.setRenderHint(QPainter.Antialiasing) painter.drawEllipse(11, 22, 10, 10) rect = QRectF(25, 17, 7, 20) painter.drawChord(rect, 270 * 16, 180 * 16) rect = QRectF(40, 11, 10, 30) painter.drawChord(rect, 270 * 16, 180 * 16) painter.drawEllipse(63, 14, 5, 5) painter.drawEllipse(63, 35, 5, 5) painter.drawEllipse(81, 14, 5, 5) painter.drawEllipse(81, 35, 5, 5) painter = None if self.data is None: text = None else: text = self.data.name self.drawText(text)
def paintEvent(self, event): painter = QPainter(self) painter.drawImage( event.rect(), self.image.scaledToWidth(self.width * self.image_pen_width)) if self.touch_age < self.touch_age_max: painter.setPen(Qt.red) painter.drawEllipse( self.touch_x * self.image_pen_width - self.circle_width / 2.0, self.touch_y * self.image_pen_width - self.circle_width / 2.0, self.circle_width, self.circle_width) if self.touch_pressure > 100: painter.drawEllipse( self.touch_x * self.image_pen_width - self.circle_width / 3.0, self.touch_y * self.image_pen_width - self.circle_width / 3.0, self.circle_width / 1.5, self.circle_width / 1.5) if self.touch_pressure > 175: painter.drawEllipse( self.touch_x * self.image_pen_width - self.circle_width / 6.0, self.touch_y * self.image_pen_width - self.circle_width / 6.0, self.circle_width / 3.0, self.circle_width / 3.0) if self.gesture_age < self.gesture_age_max: pen_width = 1 if self.gesture_pressure_max > 100: pen_width = 2 if self.gesture_pressure_max > 175: pen_width = 3 painter.setPen(QPen(Qt.darkGreen, pen_width)) if self.gesture == BrickletLCD128x64.GESTURE_LEFT_TO_RIGHT: painter.drawChord(20 - 75 / 2.0, 20, 75, 10, 90 * 16, -180 * 16) elif self.gesture == BrickletLCD128x64.GESTURE_RIGHT_TO_LEFT: painter.drawChord(20, 20, 75, 10, 90 * 16, 180 * 16) if self.gesture == BrickletLCD128x64.GESTURE_BOTTOM_TO_TOP: painter.drawChord(20, 20, 10, 75, 0, 180 * 16) if self.gesture == BrickletLCD128x64.GESTURE_TOP_TO_BOTTOM: painter.drawChord(20, 20 - 75 / 2.0, 10, 75, 0, -180 * 16)