Python cluelessness with lists
Hi, I'm trying to transition from VBScript to Python and having some trouble understanding lists in Python. What I'm trying to do is find all the comboboxes in a dialog and add them to a list. Once they are in the list I iterate through the list setting the indexes of the comboboxes. Unfortunately it's not working.
Here is a simplified version of the code omitting the iteration through the list with a 'for' statement:
dlg = some_dialog
combos = [(dlg.FindAllChildren(QtClassName,"OnOneComboBox",7))]
combos[0].QComboBox_setCurrentIndex(1)
When I run the code I get this error:
AttributeError: 'SafeArrayWrapper' object has no attribute 'QComboBox_setCurrentIndex'
What is this "SafeArrayWrapper" business?
Many thanks, John
It looks like I figured it out. I changed :
combos = [(dlg.FindAllChildren(QtClassName,"OnOneComboBox",7))]
to
combos = list(dlg.FindAllChildren(QtClassName,"OnOneComboBox",7))
Removing the brackets per your suggestion and adding "list" did the trick. Now setting the index is working and I'm able to append to the list.