import sys from PyQt5.QtWidgets import QApplication, QMainWindow, QWidget from PyQt5.QtGui import QPainter, QColor class Example(QWidget): def paintEvent(self, event): painter = QPainter(self) painter.setBrush(QColor(255, 255, 0)) # yellow painter.drawRect(0, 0, self.width(), self.height()) painter.setPen(QColor(0, 0, 255)) # blue painter.drawChord(50, 50, 200, 200, 30 * 16, 120 * 16) if __name__ == '__main__': app = QApplication(sys.argv) ex = Example() ex.show() sys.exit(app.exec_())
import sys from PyQt5.QtWidgets import QApplication, QMainWindow, QWidget from PyQt5.QtGui import QPainter, QColor class Example(QWidget): def paintEvent(self, event): painter = QPainter(self) painter.setBrush(QColor(255, 255, 0)) # yellow painter.drawRect(0, 0, self.width(), self.height()) painter.setPen(QColor(0, 0, 255)) # blue painter.drawChord(50, 50, 200, 200, 30 * 16, 180 * 16) if __name__ == '__main__': app = QApplication(sys.argv) ex = Example() ex.show() sys.exit(app.exec_())In this case, the start angle is 30 degrees and the end angle is 180 degrees (instead of 120 degrees). This will create a chord that spans half of the circle instead of a smaller portion.