I'm using PySide2 and qcp and I'd like to set the fill style on a QCPItemEllipse instance. The docs say you need to create a QPen, the set its QBrush. I have tried this but nothing happened. Here is a minimal reproducable example which you should be able to just run on its own:
from PySide2.QtCore import QPointF from PySide2.QtGui import QBrush, QPen, Qt, QRadialGradient from PySide2.QtWidgets import QApplication, QWidget, QVBoxLayout import sys from qcustomplot_pyside2 import QCPItemEllipse, QCustomPlot app = QApplication(sys.argv) window = QWidget() window.setFixedSize(500, 500) window.setLayout(QVBoxLayout()) qcustomplot = QCustomPlot() window.layout().addWidget(qcustomplot) ellipse = QCPItemEllipse(qcustomplot) ellipse.bottomRight.setCoords(-2, -2) ellipse.topLeft.setCoords(2, 2) pen = QPen() brush = QBrush(QRadialGradient(QPointF(310, 180), 200)) pen.setBrush(brush) pen.setColor(Qt.magenta) ellipse.setPen(pen) qcustomplot.replot() qcustomplot.update() qcustomplot.updateGeometry() window.update() window.show() app.exec_()