Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5947971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:02:27+00:00 2026-05-22T17:02:27+00:00

Using pyqt4 and python 2.6, I am using a qcombobox to provide a list

  • 0

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 trigger a method when the option is selected, but the problem is that when the user clicks run, the contents of several of these comboboxes need to be taken into account. So basically I need to get the selected contents of a combobox as a string. Thus far I have only been able use this:

print combobox1.currentText()

to get this:

PyQt4.QtCore.QString(u'Test Selection2')

when all I really want is the ‘Test Selection’ bit, any ideas?
My combo box was made like this:

combobox1 = qt.QComboBox()
combobox1.addItems(['Test Selection1', 'Test Selection2'])
mainLayout.addWidget(combobox1, 0, 0)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T17:02:27+00:00Added an answer on May 22, 2026 at 5:02 pm

    You can convert the QString type to python string by just using the str
    function. Assuming you are not using any Unicode characters you can get a python
    string as below:

    text = str(combobox1.currentText())
    

    If you are using any unicode characters, you can do:

    text = unicode(combobox1.currentText())
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some code creating a QTabWidget from Python using PyQt4. I want to
I have a Python application (with GUI, using PyQt4) that gets spawned by the
I'm starting a basic application using Python and PyQt and could use some experienced
Using PyObjC , you can use Python to write Cocoa applications for OS X.
I'm using Python 3.1.1 and PyQt4 (not sure how to get that version number?).
I've an python GUI application, I use pyQt4. I build binary with bbfreeze (before
I built a rather simple application in Python 3.1 using PyQt4. Being done, I
I'm writing a program using python 2.6 and pyqt4. I want this program to
I am trying to develop a plasmoid using python. I have tried eclipse with
I am using pyQt4 and want to have a Browse button in my GUI

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.