Introduction to Python for Maya: 05 Creating a UI

Опубликовано: 18 Октябрь 2024
на канале: Mathew R
27,200
481

This series of tutorials introduces the fundamentals of using Python in Maya.

********************* empty window script **********************
import maya.cmds as cmds

class MR_Window(object):

#constructor
def __init__(self):

self.window = "MR_Window"
self.title = "Cube Creator"
self.size = (400, 400)

close old window is open
if cmds.window(self.window, exists = True):
cmds.deleteUI(self.window, window=True)

#create new window
self.window = cmds.window(self.window, title=self.title, widthHeight=self.size)

#display new window
cmds.showWindow()


myWindow = MR_Window()