I am a newbie to Python Qt programming. I have been going through a tutorial at the link - https://www.pythonguis.com/tutorials/pyqt6-signals-slots-events/
The part of the tutorial that I am unable to understand is under the section "Receiving data"
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle("My App")
button = QPushButton("Press Me!")
button.setCheckable(True)
button.clicked.connect(self.the_button_was_clicked)
button.clicked.connect(self.the_button_was_toggled)
self.setCentralWidget(button)
def the_button_was_clicked(self):
print("Clicked!")
def the_button_was_toggled(self, checked):
print("Checked?", checked)
Questions
- how the author is able to pass the argument 'checked' to the function "the_button_was_toggled", since while connecting the signal 'clicked' we did not specify any arguments to the function. To me it appears more of a magic thing than something I can understand by going through relevant documentation that talks about receiving arguments from signal to slot
- Can someone provide any relevant link to PyQt6 documentation or tutorial to understand this better
Thank you for your time