0

I'm trying to build an "About" dialog window for my app. My main window is a "MainWindow" type and the "About" window is a Dialog, both created with QT Designer and transformed to ".py" files with pyuic4 --> gui_v1.py and about_v1.py

In my the main file of my app, I built this second class for the about dialog:

import gui_v1
import about_v1

class AboutDialog(QtGui.QDialog, about_v1.Ui_Dialog):
    def __init__(self, parent=None):
        super(AboutDialog, self).__init__(parent)
        self.setupUi(self)

I added the open_about() function to my main class in the main file, and linked this function to the menu button responsible for opening the about window:

class MainDialog(QtGui.QMainWindow, gui_v1.Ui_MainWindow):
    def __init__(self, parent=None):
        super(MainDialog, self).__init__(parent)
        self.setupUi(self)
        QtCore.pyqtRemoveInputHook()

        [...]

        def open_about(self):
           app = QtGui.QApplication(sys.argv)
           form = AboutDialog()
           form.show()
           app.exec_()

My main app is running from this last function:

if __name__ == '__main__':
    def main():
        app=QtGui.QApplication(sys.argv)
        form=MainDialog()
        form.show()
        app.exec_()

    main()

When clicking on the About menu item, nothing happens. I'm guessing the problem is in the open_about() function, but I can't seem to find what it is. Thanks for your help!

kaycee
  • 901
  • 1
  • 9
  • 35

1 Answers1

0

QMessageBox has some built in about box functionality. Look at

QMessageBox.about (QWidget parent, QString caption, QString text)

So you would call it something like:

QMessageBox.about (self, "About whatever....", "The text you want to display in the box")

You can look at the QMessageBox documentation here:

http://pyqt.sourceforge.net/Docs/PyQt4/qmessagebox.html

Manetho
  • 147
  • 1
  • 3