How does one write into the QCalendarWidget cell? In python, I keep getting painter not active message. Can someone help me out with this?
qp = QtGui.QPainter(self)
qp.setPen(QtGui.QColor(168, 34, 3))
qp.setFont(QtGui.QFont('Decorative', 10))
qp.drawText(rect, QtCore.Qt.AlignCenter, 'hello')
rect = QtCore.QRect()
date = QtCore.QDate.fromString('2020-01-01')
calendar = QtWidgets.QCalendarWidget(self)
calendar.paintCell(qp, rect, date)
thanks
You must inherit from
QCalendarWidgetand overwrite thepaintCellmethod.