I'm relatively new to using python in Maya. I am trying to figure out how to align the drop down menu with a button. I would like for both the drop down menu and both the buttons to be aligned with each other. What I'm getting
def win(myWin):
if cmds.window(myWin, exists = True):
cmds.deleteUI(myWin)
myWin = cmds.window(myWin, rtf = True, width=250, height=180)
cmds.columnLayout()
cmds.text(label = 'Create Controllers and Change Colours', font = 'boldLabelFont')
# Controllers
cmds.separator(height = 20)
ctrSelectMenu = cmds.optionMenu(label = 'Controller Type')
cmds.menuItem(label = 'Circle X')
cmds.menuItem(label = 'Circle Y')
cmds.menuItem(label = 'Circle Z')
cmds.menuItem(label = 'Cube'))
cmds.separator(style = 'none', height = 5)
cmds.button(label = 'Create', c = lambda x:createControls(ctrSelectMenu), width = 100, align = 'centre')
# Colours
cmds.separator(style = 'none', height = 20)
clrSelectMenu = cmds.optionMenu(label = 'Controller Colour')
cmds.menuItem(label = 'Black')
cmds.menuItem(label = 'Grey')
cmds.menuItem(label = 'Light Grey')
cmds.menuItem(label = 'White')
cmds.menuItem(label = 'Maroon')
cmds.menuItem(label = 'Red')
cmds.menuItem(label = 'Rust Red')
cmds.menuItem(label = 'Dark Blue')
cmds.menuItem(label = 'Indigo')
cmds.menuItem(label = 'Blue')
cmds.menuItem(label = 'Navy Blue')
cmds.menuItem(label = 'Sky Blue')
#cmds.separator(style = 'none', height = 5)
cmds.button(label = 'Apply', c = lambda x:controllerColour(clrSelectMenu),width = 250, align = 'right')
cmds.showWindow(myWin)
cmds.window(myWin, e=True, width=250, height=180)
win('Create Controllers')
You need to make sure you have the proper parent objects assigned and in this case you could use rowColumnLayout
def win(myWin):
if cmds.window(myWin, exists = True):
cmds.deleteUI(myWin)
myWin = cmds.window(myWin, rtf = True, width=250, height=180)
baseCol = cmds.columnLayout()
cmds.text(label = 'Create Controllers and Change Colours', font = 'boldLabelFont')
# Controllers
cmds.separator(style='in', height = 20, p=baseCol)
baseRowClo = cmds.rowColumnLayout(nc=3, p=baseCol)
ctrSelectMenu = cmds.optionMenu(label = 'Controller Type', p=baseRowClo)
cmds.menuItem(label = 'Circle X')
cmds.menuItem(label = 'Circle Y')
cmds.menuItem(label = 'Circle Z')
cmds.menuItem(label = 'Cube')
cmds.separator(style = 'none', height = 5)
cmds.button(label = 'Create', c = lambda x:createControls(ctrSelectMenu), width = 100, align = 'centre', p=baseRowClo)
# Colours
cmds.separator(style = 'in', height = 20, p=baseCol)
clrSelectMenu = cmds.optionMenu(label = 'Controller Colour', p=baseRowClo)
cmds.menuItem(label = 'Black')
cmds.menuItem(label = 'Grey')
cmds.menuItem(label = 'Light Grey')
cmds.menuItem(label = 'White')
cmds.menuItem(label = 'Maroon')
cmds.menuItem(label = 'Red')
cmds.menuItem(label = 'Rust Red')
cmds.menuItem(label = 'Dark Blue')
cmds.menuItem(label = 'Indigo')
cmds.menuItem(label = 'Blue')
cmds.menuItem(label = 'Navy Blue')
cmds.menuItem(label = 'Sky Blue')
cmds.separator(style = 'none', height = 5)
cmds.button(label = 'Apply', c = lambda x:controllerColour(clrSelectMenu), align = 'right', p=baseRowClo)
cmds.showWindow(myWin)
cmds.window(myWin, e=True, width=250, height=180)
win('Create Controllers')