Thanks Ivan. Your code works! The problem I was running into was that I was getting a few extra backslashes when viewing the knob's expression as text in a text editor. So in your example I was getting: "\[python -execlocal v= 2*3 \\nret = v]" but it should be: "[python -execlocal v= 2*3 \\nret = v]"
Cheers Pete On Wed, May 25, 2011 at 1:38 PM, Ivan Busquets <[email protected]>wrote: > Hi Pete, > > Can't check right now, but I think that should all happen automatically > depending on what kind of text you feed into setExpression. > > So, you could match the behavior of those buttons like this (again, can't > double check this now, so forgive me if the syntax is wrong) > > # No buttons active, use only Nuke's expression parser > knob.setExpression('2*3') > > # Python enabled. Internally it should be just tcl calling the python > interpreter > knob.setExpression('[python 2*3]') > > # Python enabled & Multiple statements enabled (you must fill in a "ret" > variable) > knob.setExpression('[python -execlocal ret = 2*3]') > > Would that work for you? If I remember correctly, the UI should pick that > up automatically and change the active buttons next to the Expression input > accordingly. > > Cheers, > Ivan > > > On Tue, May 24, 2011 at 5:43 PM, Pete O'Connell > <[email protected]>wrote: > >> Within the new expression window in 6.2 there are a couple buttons for >> Python Mode and for the expression's activated state. Is there a way to >> access these with scripting? At the moment when I set an expression using >> setExpression() I still have to open up the dialog to set it to 'Python >> mode' and 'Activated'. >> >> Any help would be greatly appreciated >> Pete >> >> >> _______________________________________________ >> Nuke-python mailing list >> [email protected], http://forums.thefoundry.co.uk/ >> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python >> >> > > _______________________________________________ > Nuke-python mailing list > [email protected], http://forums.thefoundry.co.uk/ > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python > > -- Pete
_______________________________________________ Nuke-python mailing list [email protected], http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
