Python Forum
[PyQt] PyQt5 drawing on scrollable area - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: [PyQt] PyQt5 drawing on scrollable area (/thread-39698.html)



PyQt5 drawing on scrollable area - HeinKurz - Mar-28-2023

Some things are not so easy to understand for me as PyQt5 newbie. Huh
I have a QTabWidget with 3 Tabs. On Tab2 I have a scrollable area and now I want to draw some graphics on that area. How can I do that ???

        ...
        self.tabWidget = QTabWidget(self)
        self.tabWidget.setContextMenuPolicy(Qt.DefaultContextMenu)
        self.setCentralWidget(self.tabWidget)
        ...
        tabGrafik = QWidget()
        self.tabWidget.addTab(tabGrafik, "Grafik")
        self.scrollArea = QScrollArea(tabGrafik)
        self.scrollArea.setGeometry(20, 100, 860, 450)
        self.labelImg = QtWidgets.QLabel()
        self.labelImg.adjustSize()
        self.scrollArea.setWidget(self.labelImg)
        ...
I want to draw on "labelImg". And before drawing I want to resize labelImg to my needs.

Thanks


RE: PyQt5 drawing on scrollable area - Axel_Erfurt - Mar-28-2023

What do you want to draw? You can load images in QLabel.


RE: PyQt5 drawing on scrollable area - HeinKurz - Mar-28-2023

(Mar-28-2023, 12:36 PM)Axel_Erfurt Wrote: What do you want to draw? You can load images in QLabel.

No images/photos. I want to draw my own graphs.


RE: PyQt5 drawing on scrollable area - Axel_Erfurt - Mar-28-2023

Look at https://github.com/pyqt/examples/tree/_/src/pyqt-official/painting/basicdrawing