I’m referring to a tutorial to learn PyQt for maya from pluralSight in that the tutor uses PyQt and maya 2015. But I’m using maya 2018, and PyQt dialog function is not working. in the tutorial he uses easily the menu toolbar and the layout to make custom Gui windows. in 2018 we have to use PySide2 instead of Qt I guess. I have searched many tutorials and code examples but when i write the exact code and try to run it, it doesnt run and gives me the error,
Error: line 1: name ‘QDialog’ is not defined
Traceback (most recent call last):
File “”, line 1, in
File “C:/Users/Nikhil/AppData/Local/Temp/MayaCode.py”, line 12, in
class Dialog(QtWidgets,QDialog):
NameError: name ‘QDialog’ is not defined
this is the code
from PySide2 import QtCore
from PySide2 import QtWidgets
from shiboken2 import wrapInstance
import maya.OpenMayaUI as omui
def maya_main_window():
main_window_ptr = omui.MQtUtil.mainWindow()
return wrapInstance(long(main_window_ptr),QtWidgets.QWidget)
class Dialog(QtWidgets,QDialog):
def __init__(self,parent=maya_main_window()):
super(Dialog,self).__init__(parent)
self.setWindowTitle("test")
self.setMinimumWidth(200)
self.setWindowFlags(self.windowFlags() ^ QtCore.Qt.WindowContextHelpButtonHint)
if name == “main”:
d = Dialog()
d.show()