Possible Duplicate:
Changing variable names with Python for loops
I have created a form that has 24 line edit boxes (objects) in it. I want to update an attribute on each object based upon data entered by the user (I want to enable or disable the line edit box).
So I am trying to do something like:
if self.cmbSelectDevice.currentText() == 'Adtran 904' :
for EnableLine in range(1, 5) :
self.lblFxsLine'EnableLine'.setEnabled(1)
for DisableLine in range (6, 24) :
self.lblFxsLine'DisableLine'.setEnabled(0)
'EnableLine' and 'DisableLine' are the values I am trying to substitute. If I did this all manually it woudl look something like:
if self.cmbSelectDevice.currentText() == 'Adtran 904' :
self.lblFxsLine1.setEnabled(1)
self.lblFxsLine2.setEnabled(1)
self.lblFxsLine3.setEnabled(1)
etc...
self.lblFxsLine6.setEnabled(0)
self.lblFxsLine7.setEnabled(0)
etc...
List and dictionaries don't really work here since I am trying to manipulate attributes on objects in a form (at least I think they don't, I am really new to python).
Any help/suggestions greatly appreciated.
Thanks!