The released signal fires when the button is released but does not send the check state, so instead, we use isChecked() to get the check state from the button in our handler. We need to keep a reference to the button on self so we can access it in our slot. Save the following app outline to a file named app.py: Let's take a look at the basics of Qt signals and how you can use them to hook widgets up to make things happen in your apps. Many Qt widgets also have their own built-in slots, meaning you can hook Qt widgets together directly.
If the signal sends data, then the receiving function will receive that data too. In Python, any function (or method) in your application can be used as a slot - simply by connecting the signal to it. Slots is the name Qt uses for the receivers of signals. You can also create your own custom signals, which we'll explore later. In addition to notifying about something happening, signals can also send data to provide additional context about what happened. Many signals are initiated by user action, but this is not a rule. That something can be any number of things, from pressing a button, to the text of an input box changing, to the text of the window changing. Signals are notifications emitted by widgets when something happens.