MCPcopy
hub / github.com/PyQt5/PyQt / BackingWidget

Class BackingWidget

Demo/BackingWidget.py:23–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21
22
23class BackingWidget(QWidget):
24 def __init__(self, *args, **kwargs):
25 super().__init__(*args, **kwargs)
26 self._showed = False
27 self._thread = BackingPaint(self)
28 self.resize(800, 600)
29
30 def closeEvent(self, event):
31 if self._thread:
32 self._thread.stop()
33 self._thread.quit()
34 self._thread.wait(100)
35 del self._thread
36 super().closeEvent(event)
37
38 def showEvent(self, event):
39 super().showEvent(event)
40 if not self._showed:
41 self._showed = True
42 self._thread.start()
43 self._thread.resized.emit(self.width(), self.height())
44
45 def resizeEvent(self, event):
46 super().resizeEvent(event)
47 if self._showed and self._thread and self._thread.isRunning():
48 self._thread.resized.emit(self.width(), self.height())
49
50 def paintEngine(self):
51 return None
52
53 @Slot()
54 def paintOnGui(self):
55 if self._thread:
56 self._thread.paintOnGui()
57
58
59if __name__ == "__main__":

Callers 1

BackingWidget.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected