Python: Refreshing window function

# Refresh window function.

class initWindow:
    def create(self,winObj):
        import maya.cmds as mc;
        if mc.window(winObj,ex=1):mc.deleteUI(winObj);
        WIN= mc.window(winObj);
        return( WIN );
    def main(self,winObj,title,wd,hg,vis):
        import maya.cmds as mc;
        WIN= self.create(winObj);
        mc.window(WIN,e=1,w=wd,h=hg,t=title);
        if vis:mc.showWindow(WIN);
        return( WIN );

# Sample code.
windowObject= "testWindow";
windowTitle= "Empty Window";
width= 400;
height= 100;
windowVisibility= True;
WIN= initWindow().main(windowObject,windowTitle,width,height,windowVisibility);

Comments

Popular posts from this blog

HIK: Getting current character and current source.