Maya Python Pyside2 GUI and Local Variable Passing Tutorial

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  10 October 2017
Maya Python Pyside2 GUI and Local Variable Passing Tutorial


I recently completed a Maya Python lesson for creating a Pyside2 GUI and passing local variables between definitions. These are two key things to know in order to create Python tools in Maya. I found the information on this a bit challenging to find, so I put together a simple lesson and template to share with all of you. Available in English and Urdu/Hindi.


Adnan Hussain
  10 October 2017
Line 75 has some code missing:
button.setStyleSheet("background-color: rgb(128,128,128); color: rgb(0,0,0") <-- At the end it should be )")

Why do you get the maya window as parent? Just wondering. There's no need to do that.

Good work!
  10 October 2017
Thanks for the correction darkgaze . Corrected in the github file. Luckily, it only caused the color to be incorrect on the button letters. Thanks for letting me know. As for the maya window parent part, I simply included it as it was a part of one of several sources I used to figure this out and cobble together a working template. Good to know it is not absolutely needed. I hope you found the code useful. Part of sharing that is so great, is to get feedback and learn from others, so thank you.

  10 October 2017
You're welcome, :-)

Anything that can be a window itself (QDialog, QWindow and QWidget) if they don't have a parent, the maya window will be its parent by default.

It will appear as another window together grouped with the maya window, but if you don't want it to appear as a separated window but a toolbox inside Maya, you can use toolbox=true flag for native UI and I remember there was a similar way inside Qt, I don't remember it right now.

  10 October 2017
Thanks again! This is useful info.
reply share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 03:32 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.