QT push button and a python lambda function
I'm just trying to create a UI for my script in maya/py using QT Designer.
The problem is that I want to use a lambda expression as a command for my buttons
by adding a dynamic property with the type set to string, property name set to "+command"
and lambda x: print('fobar!')
as the value.
But running the code back in Maya using the loadUI Pyt开发者_如何学运维hon command gives me a syntax error.
It actually loads the UI but the button's function doesn't work!
How about:
button_name.clicked.connect(lambda : print('foobar'))
精彩评论