-4

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 Python command gives me a syntax error.

It actually loads the UI but the button's function doesn't work!

agf
  • 171,228
  • 44
  • 289
  • 238

1 Answers1

0

How about:

button_name.clicked.connect(lambda : print('foobar'))
JBernardo
  • 32,262
  • 10
  • 90
  • 115