tag:blogger.com,1999:blog-7558182204270706931.post9129706101412377134..comments2024-01-11T00:39:30.194-08:00Comments on Kevman3d: Introduction to simple Maya UI coding with Pythonkevman3dhttp://www.blogger.com/profile/07025958204634108647noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-7558182204270706931.post-9016451439964033292018-02-07T21:05:34.780-08:002018-02-07T21:05:34.780-08:00Yup, without the quotes python will evaluate the f...Yup, without the quotes python will evaluate the function when the code is compiled, thinking that printTxtField() is a function that will provide a value for "command=" to use.<br /><br />To illustrate, the example below will execute the setUpCommand function to pass back the value for 'command' to use. Comments don't format white space, so that return line would be indented under the function of course. :)<br /><br />def setUpCommand():<br /> return 'printTxtField(whatUSay)'<br /><br />whatUSay = cmds.textField()<br />cmds.button(label='click me', command=setUpCommand())<br /><br />---<br /><br />If I instead placed quotes around the command function like this:<br /><br />cmds.button(label='click me', command='setUpCommand()')<br /><br />When you clicked the button, it would instead execute 'setUpCommand()' each time, which of course does nothing other than return a string.<br /><br />Hopefully that made sense?kevman3dhttps://www.blogger.com/profile/07025958204634108647noreply@blogger.comtag:blogger.com,1999:blog-7558182204270706931.post-65995447041326257712018-02-01T05:21:10.297-08:002018-02-01T05:21:10.297-08:00great tutorial!
Thank you for taking your time to...great tutorial! <br />Thank you for taking your time to expain all this.<br /><br />If I may, I do have a question: why command='printTxtField(whatUSay)'<br />instead of<br />command=printTxtField(whatUSay)<br /><br />does the command have to be a string?Anonymoushttps://www.blogger.com/profile/08284438796889216339noreply@blogger.comtag:blogger.com,1999:blog-7558182204270706931.post-60826422946990820062016-09-05T20:43:26.346-07:002016-09-05T20:43:26.346-07:00well done tutorial! thank you so much for this!well done tutorial! thank you so much for this!Kaderhttps://www.blogger.com/profile/00719083493940760847noreply@blogger.comtag:blogger.com,1999:blog-7558182204270706931.post-12614115909017951572016-06-10T20:46:03.741-07:002016-06-10T20:46:03.741-07:00Thank you for posting this great tutorial!
Big hel...Thank you for posting this great tutorial!<br />Big help! :)mmtd91https://www.blogger.com/profile/03372007243490184161noreply@blogger.comtag:blogger.com,1999:blog-7558182204270706931.post-12260930465450141472015-12-16T00:29:40.003-08:002015-12-16T00:29:40.003-08:00Great to hear it was helpful! :)
And thanks for t...Great to hear it was helpful! :)<br /><br />And thanks for the kind words - I've got a handful of other UI related tips on other articles in here if you are looking for more.<br /><br />I'm posting up some new technical material soon - Just created a whole pile of new tools, and hopefully can share a few tips from things I did...kevman3dhttps://www.blogger.com/profile/07025958204634108647noreply@blogger.comtag:blogger.com,1999:blog-7558182204270706931.post-76065641479030264382015-12-13T23:25:18.792-08:002015-12-13T23:25:18.792-08:00Hey Kev,
I'm new to building interfaces for ...Hey Kev, <br /><br />I'm new to building interfaces for Maya, and I stumbled upon this blog of yours, it was pretty handy and easy to understand, so now I have a basic knowledge of what do all those commands do and how to use them.<br /><br />Thanks a lot!<br />Alberto MartinezAnonymousnoreply@blogger.com