the entire script needs to be inside the def for it to run. the def
lobo is just checking for the window and deleting it. so if you want
lobo to actually create the window it'll have to look like  this.

import maya.cmds as mc
def lobo():
    if cmds.window("window", exists=True):
        cmds.deleteUI("window")
    # Window Layout

    MyLabel = 'window'
    window = cmds.window ('MY FIRST - BASIC PYTHON
    SCRIPT',iconName='loborig', h= 170, w=120)
    cmds.columnLayout( adjustableColumn=True )
    cmds.separator (h=5)
    cmds.text ('Basic`s Command`s')
    cmds.separator (h=5)
    cmds.button ('Make Sphere', command='cmds.sphere (r=6)')
    cmds.separator(h=150)
    cmds.separator (w=400)
    cmds.button( label='Close', command=('cmds.deleteUI(\"' + window +
        '\", window=True)') )

    cmds.setParent( '..' )
    cmds.showWindow( window )


Brandon L. Harris

On Dec 7, 1:10 pm, Vitor Lôbo Ramos <[email protected]> wrote:
> I'm using this code:
>
> import maya.cmds as mc
> def lobo():
>     if cmds.window("window", exists=True):
>         cmds.deleteUI("window")
> # Window Layout
>
> MyLabel = 'window'
> window = cmds.window ('MY FIRST - BASIC PYTHON
> SCRIPT',iconName='loborig', h= 170, w=120)
> cmds.columnLayout( adjustableColumn=True )
> cmds.separator (h=5)
> cmds.text ('Basic`s Command`s')
> cmds.separator (h=5)
> cmds.button ('Make Sphere', command='cmds.sphere (r=6)')
> cmds.separator(h=150)
> cmds.separator (w=400)
> cmds.button( label='Close', command=('cmds.deleteUI(\"' + window +
> '\", window=True)') )
>
> cmds.setParent( '..' )
> cmds.showWindow( window )
>
> # I can not rely on the code window using the "lobo" to invoke. What's
> missing?
>
> On Dec 7, 2:39 pm, Vitor Lôbo Ramos <[email protected]> wrote:
>
> > # Result: <function lobo at 0x0D6DD8F0> #
> > setFocus `paneLayout -query -pane1 viewPanes`;
>
> > this means that ... Missing Something? that can be a setfocus,
> > panelayout ... ?
> > Well, my intention is to invoke a window out either through command.
>
> > > yes. it would go something like this
>
> > > import maya.cmds as cmds
> > > def windowNAMEinvoke():
> > >     if cmds.window("windowNAME", exists=True):
> > >         cmds.deleteUI("windowNAME")
>
> > > that should be correct.
>
> > > Brandon L. Harris
>
> > > On Dec 7, 7:25 am, Vitor Lôbo Ramos <[email protected]> wrote:
>
> > > > In MEL, to invoke a window, I use the command:
> > > > global proc windowNAMEinvoke (){
>
> > > >     if (`window -ex "windowNAME"`)
> > > >         deleteUI "windowNAME";
>
> > > > would be like this in python?
>
>

-- 
http://groups.google.com/group/python_inside_maya

Reply via email to