PyQt, Maya: How to pass arguments to a function when connecting it to PyQt button?

Hello everyone,

Is there a way to pass arguments to a function in PyQt, Maya?

It’s working like this:

QtCore.QObject.connect( self.myButton, QtCore.SIGNAL(“clicked()”), self.myFunction )

but I need it to work like this:

QtCore.QObject.connect( self.myButton, QtCore.SIGNAL(“clicked()”), self.myFunction( myArgument = “something” ) )

Thanks,

Don’t use the old style signals/slots. Also, partial

from functools import partial

self.myButton.clicked.connect( partial( self.myFunction, myArgument='something') )

[QUOTE=Temujin;17818]Don’t use the old style signals/slots. Also, partial

from functools import partial

self.myButton.clicked.connect( partial( self.myFunction, myArgument='something') )

[/QUOTE]

Works like a charm, thanks Nathan.

By the way, I’ve learnt a lot from you. I wish you could make other parts of “Guide to PyQt/PySide in Maya”.

Thanks again,

I know, I know… Been too busy at work to do anything tutorial related, but I do need to get back into it.