I\'m using OSX 10.8, python 2.7.5
I just built a GUI with QtDesigner, and I was trying to figure out how to use it with Python. I found I have to use \"pyuic\" and h
I don't know about OSX, but another solution is to use the uic module of PyQt4 (pyuic4 is just a wrapper around this module). Here is an example of a custom QDialog using a ui file called mydialog.ui
:
import os
from PyQt4 import QtGui
from PyQt4 import uic
class myDialog(QtGui.QDialog):
def __init__(self, parent=None):
QtGui.QDialog.__init__(self, parent)
uic.loadUi(os.path.join(os.path.dirname(os.path.abspath(__file__)),"mydialog.ui"), self)
Note that the loadUi
method last argument is self
: this means that you will have access to all widgets as attributes of your class, ie dialog.textEdit
instead of dialog.ui.textEdit
.