Display QImage with QtGui

Simple, but complete example showing how to display QImage might look like this: #include <QtGui/QApplication> #include <QLabel> int main(int argc, char *argv[]) { QApplication a(argc, argv); QImage myImage; myImage.load(“test.png”); QLabel myLabel; myLabel.setPixmap(QPixmap::fromImage(myImage)); myLabel.show(); return a.exec(); }

PyQt: How to hide QMainWindow

Make the first window a parent of the second window: class Dialog_02(QtGui.QMainWindow): def __init__(self, parent): super(Dialog_02, self).__init__(parent) # ensure this window gets garbage-collected when closed self.setAttribute(QtCore.Qt.WA_DeleteOnClose) … def closeAndReturn(self): self.close() self.parent().show() class Dialog_01(QtGui.QMainWindow): … def callAnotherQMainWindow(self): self.hide() self.dialog_02 = Dialog_02(self) self.dialog_02.show() If you want the same dialog to be shown each time, do something like: … Read more

PyQt5 and QtGui module not found

When first trying pyqt4 and pyqt5 and the pycharm IDE I had many problems with imports. (although the imports had no prob running from IDLE) Eventually after much stuffing around, uninstalling and reinstalling, (including dependencies) the imports sorted themselves out. Did you install pyqt5 using an installer from the pyqt website? You must. Qt designer … Read more