I am trying to learn PyQt to develop a GUI for viewing images. I found some code that looked like It could be easily converted to fit my use case. Figured going line by line to check the logic would help me understand PyQt.
I am getting stuck at this line in the following class
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QFileDialog
class Ui_MainWindow(QtWidgets.QMainWindow):
def __init__(self, imgs_path,masks_path, pred_path, study):
super(Ui_MainWindow, self).__init__()
# sets up ui
self.setObjectName("MainWindow")
self.resize(1440, 1000)
self.centralwidget = QtWidgets.QWidget()
self.centralwidget.setObjectName("centralwidget")
....
self.setCentralWidget(self.centralwidget)
The line which goes self.setCentralWidget(self.centralwidget)
, what exactly is being set as the central widget? I tried to look at the documentation but wasn't able to understand what was being set as the central widget. It looks like QtWidgets.QtWidget()
is just a class containing methods for user interface?
The tutorial I was following introduced self.centralwidget
in the context of setting it to some type of widget like QtWidgets.Qlabel()
etc, so I am not sure what is actually being set as the central widget in this case.