import maya.cmds as cmds

win_name = "TEST"


if cmds.window( win_name, exists = True):
    cmds.deleteUI(win_name)
    print "The application is already opened!"
# vvvvv moved this after the check vvvvvv
win = cmds.window(win_name, title = "CHAN Importer", menuBar=True,
iconName='.chanFileImport', widthHeight=(335,221), sizeable=False)
cmds.showWindow(win)


On Wed, Sep 17, 2014 at 8:07 PM, likage <[email protected]> wrote:

> I tried something like this as a test, but I am prompted with this error
> where I am unable to create any windows. Or I could create out this TEST
> window, but when I try to relaunch another one, I got the same error as well
> # RuntimeError: Object's name 'TEST' is not unique. #
>
> import maya.cmds as cmds
>
> win_name = "TEST"
> win = cmds.window(win_name, title = "CHAN Importer", menuBar=True,
> iconName='.chanFileImport', widthHeight=(335, 221), sizeable=False)
> cmds.showWindow(win)
>
> if cmds.window( win_name, exists = True):
>     cmds.deleteUI(win_name)
>     print "The application is already opened!"
> else:
>     cmds.window(win_name)
>     cmds.showWindow(win_name)
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/0a7d7056-f4e0-489b-8f77-1524461fbd09%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/0a7d7056-f4e0-489b-8f77-1524461fbd09%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAM9RXoKAnO3BCnv7m4NGqd%2BJKEG2zeCyPH%3DpEOkiQc%2BiT%3Do3GQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to