[PySide] pyside-uic

Algis Kabaila akabaila at pcug.org.au
Thu Apr 25 08:59:57 CEST 2013


Hi,

Aaron Richiger had kindly indicated where the pyside-examples "live".   
There seems to be very few examples that use QtDesigner.  From my 
perspective of GUI programming, QtDesigner is a major attraction.

I have spent a little time with the calculator form example
(pyside-examples/examples/designer/calculatorform),
which does use QtDesigner.  The QtDesigner produces calculatorform.ui file, 
which when processed with pyside-uic creates a python file 
ui_calculatorform.py.  

Line 25 of the code is        
     self.gridlayout.setMargin(9)

My reading of the Qt Documentation seems to indicate that setMargin is   
as well as margin and margin() "class members are obsolete. They are 
provided to keep old source code working. We strongly advise against using 
them in new code." 

The code seems to work most of the tme, though the "Spyder" editor catches 
the error as AttributeError:'PySide.QtGui.QGridLayout' object has no 
attribute 'setMargin'

As code is produced via QtDesigner and pyside-uic, there is not much that 
a user can do about it, short of edit the file and ignore the warning that 
"the sky will fall down, if you do it".  Any advice?

The example is not "clever" - a much nicer "calculator" is presented in 
the PyQt Book by Mark Summerfield.  However, the example has the merit 
that it hardly has any Python code and it shows how the spin boxes can be  
accessed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20130425/6545317a/attachment.html>


More information about the PySide mailing list