[PyQt] a unhandled case uiparser.py:createSpacer

Achim Gädke Achim.Gaedke at vuw.ac.nz
Thu May 5 11:59:53 BST 2011


Hi there!

Today I used the qt designer, added some spacers to centre some knobs.

I wanted to reduce/reset the sizeHint of the spacers, so I pressed the
reset button right of the value field, which resets the sizeHint
property to 0x0, that's perfectly what I want. So I saved the .ui file
and started my application:

[...]
 File "/usr/lib/pymodules/python2.6/PyQt4/uic/uiparser.py", line 308, in
createSpacer
    width = int(elem.findtext("property/size/width"))
TypeError: int() argument must be a string or a number, not 'NoneType'

Setting the sizeHint to 1x1 works fine. - The designer sets by default a
non-zero value.

The code in createSpacer assumes the presence of width and hight
parameters, which is fatal in this case.

(I didn't dig into the definition of the .ui file, to see whether its
format requires the presence, at least the qt documentation does not
forbid 0x0 spacer dimensions.)

Cheers, Achim


More information about the PyQt mailing list