Run-time integration with Qt-Designer
Prev
Next

Chapter 4. Run-time integration with Qt-Designer

Qt-Designer is a graphical application used for designing user interfaces. It creates .ui files. These files need to be converted into Python classes before they can be used in a Python application. This can be manually done using the pyuic command from the shell. But it is a lot more convenient to let PyKDE Extensions to this automatically for you. All you need to do is import the qtdesigner or kdedesigner module, depending on whether your application is pure Qt or uses KDE, and then you can import your user interface files as though they were normal Python files.

#!/usr/bin/env python
from kdeui import *

import kdedesigner     # This module lets us import .ui file directly.
from MyWindow import * # Loads MyWindow.ui

# Subclass the Qt-designer form.
class MyWindowCode(MyWindow):
    # Implement extra functionality and methods.
The kdedesigner/qtdesigner module converts .ui on demand to .py files.

Prev
Next
Home