Mar-04-2024, 10:32 AM
Ok I think I finally figured out: if I want something to be printed (or checked) when the signal is sent, one need to define a variable that "sets" the boolean.
import sys from PySide6.QtWidgets import QApplication, QPushButton def Anyfunction(AnyArg_JustSomething): print(f"AnyArg_JustSomething = {AnyArg_JustSomething}") if __name__ == '__main__': app = QApplication(sys.argv) button = QPushButton("press me to send a signal") button.setCheckable(True) # must be set to True to allow signal(s) button.toggled.connect(Anyfunction) # signal button.show() sys.exit(app.exec())
Output:AnyArg_JustSomething = True
AnyArg_JustSomething = False
AnyArg_JustSomething = True
AnyArg_JustSomething = False
AnyArg_JustSomething = True
AnyArg_JustSomething = False
...