PDA

View Full Version : [Python] Create 2+ gridLayouts in one UI


Darius1989
07-25-2012, 01:16 PM
Heya

I guess I'm missing some type of .end command but who knows... can any1 hint me to right direction?

Gotta say making UI in maya is hard... I want max UI ! :) I know about QT... I have no idea how to get it to work thats why I'm using standard UI.... - well I got it working just no idea how to import my QT UI to maya as python :)

Thanks.

if cmds.window('Daz', exists=True):
cmds.deleteUI('Daz')

cmds.window('Daz', title='Recom Famghoyse Render Tools', w=300, h=100,mnb=False, mxb=False)

cmds.showWindow('Daz')


mainLayout = cmds.columnLayout(w=300, h=100)

cmds.text('Render Settngs ',w= 100,fn='boldLabelFont')
cmds.separator(h=5)
cmds.gridLayout(numberOfColumns=5, cellWidthHeight=(60, 25) )

cmds.button('General')
cmds.button('Features')
cmds.button('Quality')
cmds.button('All')



cmds.gridLayout( numberOfColumns=5, cellWidthHeight=(60, 25) )
cmds.button('das')
cmds.button('grew')
cmds.button('fds')
cmds.button('gds')

NaughtyNathan
07-25-2012, 01:21 PM
every timwe you want to "close" or .end a layout you use the setParent command. you can setParent to specific controls, but tbh it's easier to just set it back to "previous parent" "..".
something like:
mc.window()
mc.columnLayout()
mc.button()
mc.button()
mc.gridLayout()
mc.button()
mc.setParent('..')
mc.gridLayout()
mc.button()
mc.setParent('..')
mc.floatSlider()
mc.setParent('..')
mc.showWindow()

Darius1989
07-25-2012, 02:37 PM
Heya

That seems to work great on its own !

But I hit a wall when I try to import it and use with def. I guess it cancels the tree and only returns the 1st part of script...

How can I make space but keep on the script as one def - I want to load it as import UI....

Thanks, bye.

NaughtyNathan
07-25-2012, 05:20 PM
really? seems to work fine for me..
# saved into test.py
# ===================
import maya.cmds as mc
def ui():
mc.window()
mc.columnLayout()
mc.button()
mc.button()
mc.gridLayout()
mc.button()
mc.setParent('..')
mc.gridLayout()
mc.button()
mc.setParent('..')
mc.floatSlider()
mc.setParent('..')
mc.showWindow()

# ===================

import test
test.ui()
is this what you mean? or are you talking about something else?

Darius1989
07-25-2012, 05:32 PM
Heya

Humh strange that is +/- how I has it and it only loads untill 1st mc.setParent('..') gotta recheck it !

thanks.

Keilun
07-25-2012, 07:41 PM
Double check the whitespace. Lord knows how many hours I've lost debugging python scripts only to find out that I had mixed spaces/tabs.

CGTalk Moderation
07-25-2012, 07:41 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.