Using Signal/Slot Editor
In PyQt, the event handling mechanism is also known as signals and slots. An event can be in the form of clicking or double-clicking on a widget, or pressing the Enter key, or selecting an option from a radio button, checkbox, and so on. Every widget emits a signal when any event is applied on it and, that signal needs to be connected to a method, also known as a slot. A slot refers to the method containing the code that you want to be executed on the occurrence of a signal. Most widgets have predefined slots; you don't have to write code to connect a predefined signal to a predefined slot.
You can even edit a signal/slot by navigating to the Edit
|Â Edit Signals/
Slots
tool in the toolbar.
How to do it...
To edit the signals and slots of different widgets placed on the form, you need to switch to signals and slots editing mode by performing the following steps:
- You can press the F4 key, navigate to the
Edit
|Edit Signals/Slots
option, or select theEdit Signals/Slots...