Reputation: 61
I am using PyQt4.I have the following lines
self.lineEdit_1.setReadOnly(True)
self.lineEdit_2.setReadOnly(True)
self.lineEdit_3.setReadOnly(True)
self.lineEdit_4.setReadOnly(True)
self.lineEdit_5.setReadOnly(True)
self.lineEdit_6.setReadOnly(True)
self.lineEdit_7.setReadOnly(True)
self.lineEdit_8.setReadOnly(True)
self.lineEdit_9.setReadOnly(True)
self.lineEdit_10.setReadOnly(True)
self.lineEdit_11.setReadOnly(True)
self.lineEdit_12.setReadOnly(True)
self.lineEdit_13.setReadOnly(True)
self.lineEdit_14.setReadOnly(True)
here is what i tried
for i in range(1,15):
self.lineEdit_+int(1)+.setReadOnly(True)
I am getting invalid syntax error.
I am aware that it can be accomplished using eval or exec but i understand that these aren't the advised methods to accomplish what i want. I want to know if there is any novel and safe way to achieve the same.
Upvotes: 0
Views: 41