pyuic4 [Was: [PyKDE] Re: Building PyQt4]

Torsten Marek shlomme at
Mon Dec 12 23:12:47 GMT 2005

Hash: SHA1

Douglas Soares de Andrade schrieb:
> Hi,
> Em Segunda 12 Dezembro 2005 20:47, Torsten Marek escreveu:
>>Douglas Soares de Andrade schrieb:
>>>Hi Torsten !
>>>>you can't, unless you want to compile Qt4 yourself.
>>>>These symbols aren't exported if Qt4 is compiled with -fvisibility.
>>>Ah, ok. Thanks for the tip, i recompiled qt4 today to see if the problem
>>>was some flags, but as you know it was not.
>>>Again, thanks for the info.
>>you could just look at the 4.1 snapshots and backport the fix, if you need
>>these functions really badly. Otherwise, just leave them commented out.
> No problem, i just was trying to find a solution to this problem. I can wait 
> for the qt 4.1 :)
> Another thing, Phil said that you are porting the pyuic to PyQt4. Do you have 
> something ready ?
Not really porting, rather reimplementing. But yes, it works - which means that
there are just one gazillion bugs to fix, but it works for enough to use it, I

> If so, do you need help to test it ? Im quite interested in it, since i use 
> pyuic here.
Definitely. I originally wrote the code for Qt3, and I got loads of test harness
from existing programs. But there are not that much Qt4 programs yet, so I had
to create all test cases myself - thus, I'm lacking real-life examples.
The current code is at

If you want to use it, just copy all the files and dirs from the lib/ directory
to <python-site-dir>/PyQt4/UI (<-- which you have to create first!). This is
just a hack until the code is included into PyQt4.

pyuic4 itself is pretty straightforward. To display a ui file (using the UI
loader), do

$ pyuic4 -p <ui-file>

To compile the code (using the code generator), do

$ pyuic4 -x <ui-file> -o <output-file>

- - pyuic4 outputs the same class structure (cum grano salis) as Qt4's uic, so
please read the docs on the new system.
- - I would not be surprised at all if the program does not work on Windows yet.
Any help/bug reports appreciated!
- - if you use custom widgets with Designer, put the module which your custom
class is in into the header fields. pyuic4 then will add
"from <header> import <customclassname>"
to the generated code. This behaviour might change in the future, but it works
for customwidget-test1.ui.
- - if you ever wonder where code is printed, look at lib/Compiler/
- - all the examples in testsuite/ work or have worked at some point
"pyuic4 -p splitter.ui" is an exception, as the resulting UI differs from
"pyuic4 -x splitter.ui|python". I can't explain that. Do you have any idea, Phil?
- - more test cases are welcome, especially those that break the current code
- - usage of Q3* classes will lead to an exception, which is intended behaviour



- --
Torsten Marek <shlomme at>
ID: A244C858 -- FP: 1902 0002 5DFC 856B F146  894C 7CC5 451E A244 C858

Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird -


More information about the PyQt mailing list