Community
Maya Programming
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya SDK topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

rowColumnLayout problem - Maya Python UI

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
danispag
972 Views, 2 Replies

rowColumnLayout problem - Maya Python UI

Hi I have a problem with the rowColumnLayout. As you can see in the first image (attached below) I would like to have the 'COLOR' title centered, however I don't want it to be part of the first rowColumnLayout. Please refer to the second mockup image of how I would like it to be.

 

Any help please? Thanks in advance. Code attached below.

 

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

 

cmds.window('CRV_Generator')

 

cmds.rowColumnLayout(nc = 1)
cmds.separator(style='none', h=5)

 

cmds.text(label='CREATE SHAPES')

 

cmds.separator(style='none', h=5)

cmds.rowColumnLayout(nc = 2)

 

cmds.button(label = 'Circle', w = 150, c = 'createCircle()')
cmds.button(label = 'Square', w = 150, c = 'createSquare()')
cmds.button(label = 'Box', w = 150, c = 'createBox()')
cmds.button(label = 'Pyramid', w = 150, c = 'createPyramid()')
cmds.button(label = 'Triangle', w = 150, c = 'createTriangle()')
cmds.button(label = 'Info', w = 150, c = 'createInfo()')
cmds.button(label = 'Double Arrow', w = 150, c = 'createDoubleArrow()')
cmds.button(label = 'Arrow', w = 150, c = 'createArrow()')
cmds.button(label = 'Directional', w = 150, c = 'createDirectional()')
cmds.button(label = 'Platonic', w = 150, c = 'createPlatonic()')

 

cmds.rowColumnLayout(nc = 1)

cmds.separator(style='none', h=5)

 

cmds.text(label='COLOR')

 

cmds.separator(style='none', h=5)

cmds.rowColumnLayout(nc = 2)

 

cmds.button(label = 'Red', w = 150, c = 'changeColor(13)')
cmds.button(label = 'Blue', w = 150, c = 'changeColor(6)')
cmds.button(label = 'Yellow', w = 150, c = 'changeColor(17)')
cmds.button(label = 'Green', w = 150, c = 'changeColor(14)')
cmds.button(label = 'Pink', w = 150, c = 'changeColor(9)')
cmds.button(label = 'Light Blue', w = 150, c = 'changeColor(18)')

 

cmds.showWindow()

2 REPLIES 2
Message 2 of 3

Hi,

Try this.....

import maya.cmds as cmds
if cmds.window('CRV_Generator', exists = True):
    cmds.deleteUI('CRV_Generator')
cmds.window('CRV_Generator')
cmds.rowColumnLayout(nc = 1)
cmds.separator(style='none', h=5)
cmds.text(label='CREATE SHAPES')
cmds.separator(style='none', h=5)
cmds.rowColumnLayout(nc = 2, columnWidth=[(1, 150), (2, 150)])
cmds.button(label = 'Circle', w = 150, c = 'createCircle()')
cmds.button(label = 'Square', w = 150, c = 'createSquare()')
cmds.button(label = 'Box', w = 150, c = 'createBox()')
cmds.button(label = 'Pyramid', w = 150, c = 'createPyramid()')
cmds.button(label = 'Triangle', w = 150, c = 'createTriangle()')
cmds.button(label = 'Info', w = 150, c = 'createInfo()')
cmds.button(label = 'Double Arrow', w = 150, c = 'createDoubleArrow()')
cmds.button(label = 'Arrow', w = 150, c = 'createArrow()')
cmds.button(label = 'Directional', w = 150, c = 'createDirectional()')
cmds.button(label = 'Platonic', w = 150, c = 'createPlatonic()')
cmds.columnLayout(w=300)
cmds.separator(style='none', h=5, w=300)
cmds.text(label='COLOR', w=300)
cmds.separator(style='none',w=300, h=5)
cmds.rowColumnLayout(nc = 2, columnWidth=[(1, 150), (2, 150)])
cmds.button(label = 'Red', w = 150, c = 'changeColor(13)')
cmds.button(label = 'Blue', w = 150, c = 'changeColor(6)')
cmds.button(label = 'Yellow', w = 150, c = 'changeColor(17)')
cmds.button(label = 'Green', w = 150, c = 'changeColor(14)')
cmds.button(label = 'Pink', w = 150, c = 'changeColor(9)')
cmds.button(label = 'Light Blue', w = 150, c = 'changeColor(18)')
cmds.showWindow()
Message 3 of 3

Thanks so much that worked perfectly 🙂

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report