I am new to Python. I have created a button using PyQt and want to call two separate functions by clicking the same button
QtCore.QObject.connect(self.start, QtCore.SIGNAL('clicked()'), self.trial,self.trial2)
You can just connect the signal twice, like:
QtCore.QObject.connect(self.start, QtCore.SIGNAL('clicked()'), self.trial)
QtCore.QObject.connect(self.start, QtCore.SIGNAL('clicked()'), self.trial2)
Both functions will be called when the signal is emitted. According to the document:
If a signal is connected to several slots, the slots are activated in the same order in which the connections were made, when the signal is emitted.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With