On Mon, Dec 10, 2012 at 4:00 AM, <[email protected]> wrote:
> is there any other method I can follow to shorten the
> tortuous list of repetitive commands for initializing multiple widgets?
If you don't mind referring to the objects by index number rather
than individual names, you can do this:
self.myListOfEightSpinners = [ QSpinBox() for i in range(8) ]
It's very "pythonic"! However, judging from the names you have
used, you have X-Y pairs of spinners, in which case there might be
some coding advantage to having four lists of two, as in
self.p1xyVals = [ QSpinBox(), QSpinBox() ]
self.p2xyVals = [ QSpinBox(), QSpinBox() ]
etc. Then you could write e.g. a function
def XYDistance( xySpinBoxPair ) :
and so forth.
_______________________________________________
PyQt mailing list [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt