The wiki is in the process of moving to Please make your edits there.

PySideSimplicissimus_Module_3_AboutBox | Qt Wiki | Qt Project

English French [] 日本語

About Box

This dialog box shows the version of About Box itself, as well as versions of Qt, PySide and Python beeing used, together with the platform on which the program is being run.

First step is to use Qt Designer to visually design the main window and add one PushButton. We give the name by Saving As the file about.ui (ui extension is added by the Qt Designer).

All current source code for “Close”, “About”, “Show Licence”, all versions of “Combined”, “Engineering Application” aka “truss” are stored in one repository tuts4pyside. For your convenience, please install a copy of the repository with the following command:

  1.   git  clone

If you do not have git, pllease install it first.

View the about.ui with Qt Designer at your leisure. The about.ui is an XML file. If you can not read it, do not let it bother you – Python can not read it, either… To make it readable to python we need to process it with a script from pyside-tools package:

  1. pyside-uic about.ui >

The Python readable file can now be imported by the program and used as shown in the following code listing

  1. #!/usr/bin/env python
  2. # - display about box with info on platform etc.
  4. import sys
  5. import platform
  7. import PySide
  9. from ui_about import Ui_MainWindow
  11. __version__ = '0.0.1'
  13. class MainWindow(QMainWindow, Ui_MainWindow):
  14.     def __init__(self, parent=None):
  15.         super(MainWindow, self).__init__(parent)
  16.         self.setupUi(self)
  17.         self.aboutButton.clicked.connect(self.about)
  19.     def about(self):
  20.         '''Popup a box with about message.'''
  21.         QMessageBox.about(self, "About PySide, Platform and the like",
  22.                 """<b>Platform Details</b> v %s
  23.                <p>Copyright 2010 Joe Bloggs.
  24.                All rights reserved in accordance with
  25.                GPL v2 or later - NO WARRANTIES!
  26.                <p>This application can be used for
  27.                displaying platform details.
  28.                <p>Python %s -  PySide version %s - Qt version %s on %s""" % (__version__,
  29.                 platform.python_version(), PySide.__version__,  PySide.QtCore.__version__,
  30.                 platform.system()))
  32. if __name__ == '__main__':
  33.     app = QApplication(sys.argv)
  34.     frame = MainWindow()
  36.     app.exec_()

The main program is right at the end. It mostly follows a common pattern. We call the application app and pass to it any CLI arguments in sys.argv. A chosen name for the window frame is frame, but it could be anything at all. tells the system to show the frame as soon as the application cycle starts running and finally, app.exec_() starts the application cycle, which enables user interaction by clicking on buttons and the like.

A note about the listing of contents of the text in the about dialog popup box: the character copy; has been re-interpreted to what it represents in HTML, namely little c with a small circle around it. Actually, in the program it needs to be written just as shown in the previous sentence.

The can be run the same way as any other Python program. Enjoy!

Return to PySideSimplicissimus