! , arg__1 PySide.
combo.currentIndexChanged [str], combo.currentIndexChanged [unicode], Unicode .
, :
from PySide import QtCore
from PySide import QtGui
class myDialog(QtGui.QWidget):
def __init__(self, *args, **kwargs):
super(myDialog, self).__init__(*args, **kwargs)
combo = QtGui.QComboBox()
combo.addItem('Dog', 'Dog')
combo.addItem('Cat', 'Cat')
layout = QtGui.QVBoxLayout()
layout.addWidget(combo)
self.setLayout(layout)
combo.currentIndexChanged[int].connect(self.intChanged)
combo.currentIndexChanged[str].connect(self.strChanged)
combo.currentIndexChanged[unicode].connect(self.unicodeChanged)
combo.setCurrentIndex(1)
def intChanged(self, index):
print "Combo Index: "
print index
print type(index)
def strChanged(self, value):
print "Combo String:"
print type(value)
print value
def unicodeChanged(self, value):
print "Combo Unicode String:"
print type(value)
print value
if __name__ == "__main__":
app = QtGui.QApplication([])
dialog = myDialog()
dialog.show()
app.exec_()
:
Combo Index
1
<type 'int'>
Combo String
<type 'unicode'>
Cat
Combo Unicode String
<type 'unicode'>
Cat
, basestring IndexError: Signature currentIndexChanged(PyObject) not found for signal: currentIndexChanged. PySide, -, int, float ( double), str/unicode ( unicode) bool, python PyObject .
, -!