2
I have the following code:
self.option = QComboBox(self)
self.option.addItems(self.getJson)
def getJson(self):
self.data = {'image' : ['planet.jpg', 'cat.png', 'building.jpg']}
return self.data['image']
I want to make the function return getJson
go to the QComboBox
which I created, however, when running the code, this error message appears:
Typeerror: 'Pyside.QtGui.Qcombobox.addItems' called with Wrong argument types: PySide.QtGui.QComboBox.addItems(method)
How do I make for the addItems
receive the return of the method without giving this error?
the return of
getjson
shouldn’t be a json string?– Miguel
and isn’t it? My code looked like this: self.option = Qcombobox(self) self.data = {'image' ['Planet.jpg', 'cat.png', 'building.jpg']} self.option.addItems(self.data['image'])
– alexandre9865
Attention to @zekk’s response below, I think it solves the problem
– Miguel
I saw @Miguel , but I want to modularize the code.
– alexandre9865
I think I know what’s going on, so try this
self.option.addItems(self.getJson())
. Parentheses were missing I think– Miguel
gave! thanks @Miguel
– alexandre9865