I’m working on some code where I need to create a list of QActions corresponding to the COM ports on the system, which will be added to the menu bar depending upon which COM ports are available. It looks sort of like this:
self.actionCOM1 = QtGui.QAction(QtGui.QIcon(''), 'COM1', self)
self.actionCOM1.setCheckable(True)
self.COMPorts.append(self.actionCOM1)e here
It would make my life easier if there were a way to do this so I didn’t have to repeat this block of code over and over, is there some way to just append a loop index number to the end of “self.actionCOM”?
Do you mean something like this?