So I am having a few issues using with statements to tab out my UI
code. below is a very simplistic example. The biggest problem is that
when laying out tabLayouts, you must first declare a formLayout, then
the tabLayout, then edit the form to attach the tabs. If you try this
entirely within 'with' statements it fails. If you remove the 'with'
statement from the line to edit the form and leave as pyMel, it works
fine...BUT, it seems you cannot then continue using 'with' statements
for the content of that tab. The following code uses the example from
the pyMel docs, which fails for the same reason :

from __future__ import with_statement
from pymel.core import *
template = uiTemplate( 'ExampleTemplate', force=True )
template.define( button, width=100, height=40, align='left' )
template.define( frameLayout, borderVisible=True, labelVisible=False )

with window(menuBar=True,menuBarVisible=True) as win:
# start the template block
    with template:
        with columnLayout( rowSpacing=5 ):
            with frameLayout():
                with columnLayout():
                    button( label='One' )
                    checkBox()
                with frameLayout():
                    button()
                    with optionMenu() as optM:
                        menuItem (l='test')
                        menuItem (l='test2')

##### However, if we use :
optionMenu()
menutItem(l='test')

it works just fine.

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to