Vlad
Vlad

Reputation: 419

PyQt. Create button which will be in pressed state when it's clicked

everyone. I started learning pyQt and I want a button which will be when clicked always in pressed state and when it's going to be clicked again , it's going to be released. I guess it can be achieved with QtWidgets.QPushButton, but which flags to use I don't know. I tried to read all of them , but a lot still looks so hard to grasp. Can anybody help newbie ? Thanks

Upvotes: 1

Views: 710

Answers (1)

Michael Schm.
Michael Schm.

Reputation: 2534

You can use QPushButton and you have to enable QPushButton::setCheckable to true. Note: this flag is not available in Qt Creator and must be set programatically.

setCheckable() sets whether the button is a toggle button or not.

Upvotes: 3

Related Questions