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 9195287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:35:47+00:00 2026-06-17T21:35:47+00:00

I am using pyQT 4.8.3 in order to create a proper GUI for a

  • 0

I am using pyQT 4.8.3 in order to create a proper GUI for a QGIS plugin

There are three widgets in the form

my_comboBox , my_lineEdit , my_spinBox

Assume that comboBox has three entries

'combo_first_item' , 'combo_second_item' , 'combo_third_item'

What exactly I want is;

if 'combo_second_item' is selected, then my_lineEdit toggles state to disabled
if 'combo_third_item' selected, then my_spinBox toggles state to disabled

So, how can I toggle enabled state of widgets in the form based on selected string (or index value) from the combobox?

What should be the proper signal -> slot assignment?
Unlike QbuttonBox, QcomboBox does not fire SetDisabled slot

Thanks.

  • 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-06-17T21:35:48+00:00Added an answer on June 17, 2026 at 9:35 pm

    Make a dictionary that maps the string to widget:

    widgets = {'combo_first_item': my_comboBox,
               'combo_second_item': my_lineEdit,
               'combo_third_item': my_spinBox}
    

    And a slot:

    def disableWidget(currentIndex):
         widget = widgets[currentIndex]
         widget.setEnabled(False)
         # or anything else you want to do on the widget
    

    Then you can connect the currentIndexChanged[QString] signal to this:

    comboBox.currentIndexChanged['QString'].connect(disableWidget)
    

    Alternatively you can use currentIndexChanged[int] and a list instead of a dictionary.

    PS: If this is inside a class instance, put self accordingly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using PyQt to create a GUI application. In a view inherited from QTableView,
I'm using PyInstaller to create a single executable of a python program using PyQt.
I'm new to QT. I'm using PyQT for GUI development in my project. I
I am using PyQT for making Gui , in which i am controlling volume
I am using PyQt and want to create a menu based on a list
I am using PyQt to make a GUI for a circuit simulator, and am
I have a problem with keeping a GUI responsive using PyQt and Qthreads. What
Are there any examples how to authenticate your desktop Facebook application using PyQT and
I need to display data using the PyQt class QTableWidget . But there could
I need to make a timeline like this: using PyQt for the gui. Basically,

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.