Qt for Python UiFiles

From Qt Wiki
Revision as of 17:18, 14 January 2015 by Maintenance script (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

How to use Qt Creator to design Graphical Interfaces for PySide

This page describes the use of Qt Creator to create Graphical Interfaces for your PySide Software. You will need Qt Creator, Pyside and PySide-Tools (pyuic and pyrcc).

If you don’t know how to use Qt Creator, please go to Qt Creator (ver 2.5) Widget Tutorial [qt.io].

At Qt Creator, create a new Qt Design Form, choose “Main Window” for template. And save as “mainwindow.ui” . Add a Qlabel to the center of the centralwidget. You should get somethig like this :

mainwindow

And your mainwindow.ui
Python can’t read this ui file so to make it readable to python we need to process it with a script pyside-uic.
The command is:

The generated output file “mainwindow.py” is as follows:
we have to modify this mainwindow.py module:

And to run:

Categories: