user3135832
user3135832

Reputation: 211

How to disable button until check box is checked in pyqt?

I am creating an app and I need to disable a button until the user agrees to the terms. I looked online, but couldn't find anything. Any help would be great.

EDIT: I am using pyqt4.

Upvotes: 3

Views: 2445

Answers (1)

Robert
Robert

Reputation: 10943

You should use the strategy of signal/slots in Qt. When the checkbox send the checked signal you catch it with the slot defined in your button. Of course you should connect both widgets. For example:

connect(checkbox, SIGNAL(stateChanged(int)), button, SLOT(buttonStateChanged(int)));

This signals and slots maybe don't exists, and you have to create them. It is just the main idea.

I think that is a right way.

Here are some examples of connections in python, using signal/slots. And here is (maybe) what you need.

Upvotes: 2

Related Questions