Skip to content Skip to sidebar Skip to footer

Waiting In For Loop Until Qradiobutton Get Checked Everytime?

I have a situation where i need to get Pass/Fail from tester for every test step in PySide GUI. Now the data of testsuite i am running in for loop and trying to get current checked

Solution 1:

If I understood you correctly, you want to wait until one of buttons (fail_radio or pass_radio) is checked before if self.ui.pass_radio.isChecked(): line.

In Qt, you can achieve this using QEventLoop like here: waiting for a signal, where signal you want to wait for is clicked. You need to connect both buttons' signals to quit slot before executing it. For signal/slot connecting in PyQt you can look here: http://pyqt.sourceforge.net/Docs/PyQt5/signals_slots.html

So you need to write something like:

loop = QtCore.QEventLoop()
self.ui.fail_radio.clicked.connect(loop.quit)
self.ui.pass_radio.clicked.connect(loop.quit)
loop._exec()

Post a Comment for "Waiting In For Loop Until Qradiobutton Get Checked Everytime?"