Deleting an existing window

Deleting an existing window

Anonymous
Not applicable
544 Views
3 Replies
Message 1 of 4

Deleting an existing window

Anonymous
Not applicable
Hello,

I have a UI Window that is created by clicking on a Maya menu item at the top of maya. I have code that is suppose to delete the window if it exists but for some reason it always returns false and another window is created.

def showMyWindow(*args):
# We only want one window at a time
if mel.eval('window -exists myWindow'):
mel.eval('deleteUI myWindow')

# Make the window
myWindow = window( title="Actor Information", iconName='ActorInfo',widthHeight=(260,350))

myWindow.show()

I'm wondering if the problem might be that I am creating the window in pymel but checking for it's existence through Mel?
0 Likes
545 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
I think the forum may have messup your code, (and it will probably mangle mine as well, but this works for me


if mel.eval("window -exists myWindow"):
mel.eval("deleteUI myWindow")

0 Likes
Message 3 of 4

Anonymous
Not applicable
Yep that is the same as my code but mine doesn't work. It always fails on finding the window.
0 Likes
Message 4 of 4

Anonymous
Not applicable
Since you are using Pymel, why not use Pymel?


try:
myWindow.delete()
except:
pass
myWindow = window( title="Actor Information", iconName='ActorInfo',widthHeight= (260,350))
0 Likes