I have a function:
def pausing(ses):
if ses.is_paused() == True:
ses.start()
else:
ses.pause()
which is pausing a torrent downloading or resuming it (depends on an actual state of torrent). I want to connect this function with a button, like this:
QtCore.QObject.connect(self.pausebutton, QtCore.SIGNAL(_fromUtf8("clicked()")), pause)
But I don't know how to pass an argument ses to that slot (it's in a different class than the ses, which I want to pass). I don't want to use global variables - how can I resolve my problem?
There are two methods (I am using self.on_button
as an example function)
Something like this:
button1.clicked.connect(partial(self.on_button, 1))
And:
button1.clicked.connect(lambda: self.on_button(1))