Announcements

Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.

Community
Maya Programming
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya SDK topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Invalid syntax

1 REPLY 1
SOLVED
Reply
Message 1 of 2
roshanshilimkar3434
284 Views, 1 Reply

Invalid syntax

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.,

 

 

 

 

1 REPLY 1
Message 2 of 2

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!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report