This question pertains to 'Practice: Flipping Sprites'. I believe I may already know the answer, but I wanted to get confirmation.
I noticed that the callback for the 'toggled' signal that we connect to our check_buttons seems to pass a bool argument automatically to the callback function that we specify (_on_CheckButtonFlipH_toggled and _on_CheckButtonFlipV_toggled). In the previous sections, the 'pressed' signal that we used did not appear automatically send an argument to the callback function in this same way. Furthermore, I tried changing to callback function for the toggled signals to a function that I arbitrarily defined and noticed that the function did not seem to work unless I specified a bool parameter in the function definition.
I checked the 'Node' dock and saw the following:
Am I right in understanding that the toggled signal is different from the other three signals in that it will automatically pass the bool argument to the callback and thus a bool parameter must be in the callback function definition?
Thanks for any clarification you can provide!
SSkibity The documentation for BaseButton shows that the toggled signal does indeed contain an argument (bool) named button_pressed, which contains the new state. Given the nature of a toggle, it seemingly exists here so you know which state, where as a press is a press, and a release is a release. Given that this is not an optional argument, I believe you are right in that it must be passed, which is why you ran into issues with your arbitrary function without it, and no issues when the boolean was present.
Yep! You did understand correctly; some signals pass arguments, and some do not.
As you noticed, if a signal does pass parameters, connecting it with a function with an incompatible amount of arguments produces an error.
You can know the number of arguments a signal passes and what they are by reading the documentation or checking the "node" panel in the editor.