Using Qt Designer in maya

Using Qt Designer in maya

Anonymous
Not applicable
6,957 Views
2 Replies
Message 1 of 3

Using Qt Designer in maya

Anonymous
Not applicable

OK, I'm confused about this.  Again.   I think I've done this now at 4 different companies, and I am always befuddled when I start again.

We are using maya 2020.  I am starting a new (python) code base from scratch, so I can do it in whatever is considered the "right" way RIGHT NOW.  So, working in python both inside and outside maya, I would like to using designer to create .ui files, and then read those .ui files into my python code and instantiate the ui, hopefully without having to translate the .ui to .py.

So... Do I use Pyside2 or PyQt5?   What are the pros and cons for either?   Is there good simple example code for properly ingesting and instanciating a gui from a .ui file in each?

Any other hints on techniques or problems that I'm overlooking?

 

Thanks and sorry for my simple-mindedness.

 

Accepted solutions (1)
6,958 Views
2 Replies
Replies (2)
Message 2 of 3

g2m.agent
Collaborator
Collaborator
Accepted solution

You should use Pyside2 because Maya has Pyside2 built in.

 

here is the document:

https://help.autodesk.com/view/MAYAUL/2020/ENU/?guid=__developer_Maya_SDK_MERGED_Maya_Python_API_Wor...

 

here are some most basic codes:

 

from PySide2.QtCore import *
from PySide2.QtWidgets import *
from PySide2.QtUiTools import QUiLoader 

UI_FILE = "f:/tmp/untitled.ui"

ui_file = QFile(UI_FILE)
ui_file.open(QFile.ReadOnly)
loader = QUiLoader()
ui = loader.load(ui_file)
ui_file.close()

ui.show()

 

 

Message 3 of 3

Anonymous
Not applicable

Thanks!

0 Likes