A PyQt button event can be connected in the normal way to a function so that the function receives the default signal arguments (in this case the button checked state):
def connections(self):
my_button.clicked.connect(self.on_button)
def on_button(self, checked):
print checked # prints "True"
Or, the default signal arguments can be overridden using lambda
:
def connections(self):
my_button.clicked.connect(lambda: self.on_button('hi'))
def on_button(self, message):
print message # prints "hi"
Is there a nice way to keep both signal arguments so it can be directly received by a function like below?
def on_button(self, checked, message):
print checked, message # prints "True, hi"