XM Magdalena 3D print, GGeorgy (3D)
LC #42 Pipers Alley

View Full Version : deleting User Interface with python...?

03-20-2009, 12:41 AM
I just started learning phyton a week ago.Ive been using Mel for the last 2 years,and so far the transition to python is going Ok.But I am having many little problems.For instance,I have done a million time a deleteUI window if the window exists with Mel,but I dont find the right way to do it with python.So,can someone tell me why the following is not correct?

import maya.cmds as mc
if myWindow=mc.window(query=True,exists=True):
myWindow=mc.window(title="titulo de ventana",wh=(200,200))


03-20-2009, 01:39 AM
cause you are saying myWindow = a boolean - (True or False)...Your logic is trying to delete a UI with a boolean name of True.....you should name your window and call that name, not a variable that holds the name. The variable may not even exist yet to test with the if. It isn't created till after the if.

import maya.cmds as mc
if mc.window('myWindow', query=True,exists=True):
myWindow = mc.window('myWindow',title="titulo de ventana",wh=(200,200))

03-20-2009, 11:43 AM
ok.Thanks a lot.Understood.

CGTalk Moderation
03-20-2009, 11:43 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.