PDA

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


shenmue
03-20-2009, 01:41 AM
Hi
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):
mc.deleteUI(myWindow,window=True)
myWindow=mc.window(title="titulo de ventana",wh=(200,200))
mc.showWindow(myWindow)


Thx

tbaypaul
03-20-2009, 02: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):
mc.deleteUI('myWindow',window=True)
myWindow = mc.window('myWindow',title="titulo de ventana",wh=(200,200))
mc.showWindow(myWindow)

shenmue
03-20-2009, 12:43 PM
ok.Thanks a lot.Understood.

CGTalk Moderation
03-20-2009, 12:43 PM
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.