[PyKDE] Installing PyQt4 on (k)ubuntu

Andreas Pakulat apaku at gmx.de
Tue Jan 24 15:07:29 GMT 2006


On 24.01.06 15:52:07, Fabio Spelta wrote:
> I created a .ui interface with the Qt4 designer and I converted it to
> .py with pyuic4.
> 
> Too bad I can't find the right way to create a main wrapper to show

How about: pyuic4 --help? Use the -x Option and then you can just do a 

python <generated-code>.py

> import sys
> from PyQt4 import QtGui
> 
> app = QtGui.QApplication(sys.argv)
> 
> but I cant' "import" the main frame into the app in any way. How can I
> please do that?

Huh?? A simple example for a generated file mywidgetui.py would be:

import sys
from PyQt4 import QtGui
from mywidgetui import Ui_MyWidgetUI

app = QtGui.QApplication(sys.argv)
widget = QtGui.QWidget()
ui = Ui_MyWidgetUI()
ui.setupUi(widget)
widget.show()
sys.exit(app.exec_())

That's basically the same code pyuic4 generates when you tell it to with
the -x option.

Andreas

-- 
Don't get to bragging.




More information about the PyQt mailing list