Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Invalid syntax

Invalid syntax

roshanshilimkar3434
Advocate Advocate
440 Views
1 Reply
Message 1 of 2

Invalid syntax

roshanshilimkar3434
Advocate
Advocate

Hey, I am new to programming and following a tut for creating a blank window using python, I've started maya 2022 with python2, what am I doing wrong? this is the exact code used in the tutorial

 

from PySide2 import QtCore
from PySide2 import QtWidgets


class TestDialog(QtWidgets.QDialog):
def_init_(self, parent=None):
super(TestDialog, self)._init_(parent)


if_name_ == "_main_":

d = TestDialog()
d.show()

 

thank you.,

 

 

 

 

0 Likes
Accepted solutions (1)
441 Views
1 Reply
Reply (1)
Message 2 of 2

Kahylan
Advisor
Advisor
Accepted solution

Hi!

 

You're missing the spaces after "def" and "if".

 

from PySide2 import QtCore
from PySide2 import QtWidgets


class TestDialog(QtWidgets.QDialog):
    def _init_(self, parent=None):
        super(TestDialog, self)._init_(parent)
        
        
        if _name_ == "_main_":
        
            d = TestDialog()
            d.show()

 

I hope it helps!