开发者

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'))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜