Normally I would never want to do this, but in this case I feel as though there's no alternative. I'm building a program in pyqt that has many label widgets, and alot of which are the same with the exception of a couple places on the geometry.
I would like to automate declaring them instead of having to declare them line by line which is taking up a lot of lines. It also looks pretty ugly.
Is there a way to say create ten variables like var1, var2, var3, etc. without having to declare them line by line?
Right now my code looks like-
self.folderheader1 = QtGui.QLabel(self.folders)
self.folderheader2 = QtGui.QLabel(self.folders)
self.folderheader3 = QtGui.QLabel(self.folders)
self.folderheader4 = QtGui.QLabel(self.folders)
...
setattr, but are you sure you want to? Why not create adictorlistinstead?