roham
1
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,
Temujin
2
Don’t use the old style signals/slots. Also, partial
from functools import partial
self.myButton.clicked.connect( partial( self.myFunction, myArgument='something') )
roham
3
[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,
Temujin
4
I know, I know… Been too busy at work to do anything tutorial related, but I do need to get back into it.