I have this simple window (design.py) derived from Qt designer, which consists of three radio buttons:
# -*- coding: utf-8 -*-
from PyQt4 import Qt
The toggle()
signal is emitted every time any radio button's state changes. As a result, the toggle()
signal is emitted when you click on a radio button and that radio button's state changes from unchecked to checked, and if clicking on the radio button automatically unchecks another radio button, then the toggle()
signal is emitted again because the other radio button's state changes from checked to unchecked.
You can see that in action by adding the following line to the end of your slot:
print self.sender().text() + ' was toggled'
Use the clicked()
signal instead--a radio button whose state was automatically changed from checked to unchecked was never clicked.