def drawTextItem(self, pos, textItem): device = self.nullDevice() if device is None: return if device.mode() != QwtNullPaintDevice.NormalMode: QPaintEngine.drawTextItem(pos, textItem) return device.drawTextItem(pos, textItem)