I'm developing a GUI dialog using PyQT4 which imports some data into a Pandas DataFrame and then plots the data to an embedded Matplotlib canvas.
I'd like to pass a list of variable from the DataFrame to the combo box. My first attempt was:
list = list(df.parameter,unique())
self.FirstComboBox = QtGui.QComboBox()
self.FirstComboBox.addItems(list)
But on running this I get
TypeError: QComboBox.addItems(QStringList): argument 1 has unexpected type 'list'
I've seen examples where a sorted list of dict keys is passed to a combo box, so I'm confused that I can't pass a list.
Ben
In the end I got this to work. But I'm not happy with it.
for i in range(len(channels)):
self.MyComboBox.addItem(channels[i])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With