How do you get the current text contents of a QComboBox?

前端 未结 4 1777
误落风尘
误落风尘 2020-12-05 06:40

Using pyqt4 and python 2.6, I am using a qcombobox to provide a list of options. I am having problems with using the selected option. I have been able to use a signal to tri

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-05 07:19

    If you want the text value of a QString object you can use the __str__ property, like this:

    >>> a = QtCore.QString("Happy Happy, Joy Joy!")
    >>> a
    PyQt4.QtCore.QString(u'Happy Happy, Joy Joy!')
    >>> a.__str__()
    u'Happy Happy, Joy Joy!'
    

    Hope that helps.

提交回复
热议问题