Posts

Showing posts from July 30, 2017

Maya UI Layout Example

Image
In reply to another StackOverflow question , I wrote 2 blocks of code that shows 2 UI layouts created with Maya's UI framework. First one looks like this: This is the code that created this first one. import maya . cmds as mc def buildUI (): winName = 'myWindow' winWidth = 200 # set a target width and reference this when you specify width if mc . window ( winName , exists = True ): mc . deleteUI ( winName ) mc . window ( winName , width = winWidth , title = 'Test Window' ) # i always have keep a reference to the main columnLayout mainCL = mc . columnLayout () mc . text ( label = 'text row 1' ) # tmpRowWidth controls the width of my columns in the rowLayout # with reference to winWidth tmpRowWidth = [ winWidth * 0.3 , winWidth * 0.7 ] mc . rowLayout ( numberOfColumns = 2 , columnWidth2 = tmpRowWidth ) # at this point our UI pointer is under the rowLayout mc . text ( label = 'row colu