Passing list to class init, pyQt
I'm new to Python and pyQt. I've got a class for a QDialog, and am passing a list of strings to this class in the init;
class Remove_Source(QtWidgets.QDialog, Ui_R_Source): def __init__(self, items=None): super(Remove_Source , self).__init__() self.ui = Ui_R_Source() self.ui.setupUi(self) self.setWindowTitle("Remove Source Folders") self.items = items or  for i in range(self.items.count()): self.ui.keep_window.addItem(self.items(i)) self.exec()
The list is inaccessible within the class. Anyone know what I'm doing wrong? Thanks
What do you mean by "inaccessible"?
Also, how do you pass the list to the constructor?
And this is wrong:
@robbiecooper In your code there is even more wrong:
does not do what you think it does and will cause you app to crash (count() counts how often an element, which is passed as parameter, occurs in the list).
It should be
Thanks @jsulm!! That sorted it!