Search code examples
pythonuser-interfacemaya

How to align Button to right in maya python


I want to align button to the right and create checkbox to the left. I want to display button and checkbox in one line .Thank you

Code:

import maya.cmds as cmds

cmds.window( width=200 )
cmds.columnLayout( adjustableColumn=False )
cmds.button( label='Submit Job',width=130,align='right')
cmds.checkBox(label='Scout Job')
cmds.showWindow()

Output enter image description here

Expected output enter image description here


Solution

  • I've answered you on your previous question but you have to think your layouts :

    import maya.cmds as cmds
    
    cmds.window( width=200 )
    main = cmds.columnLayout( adjustableColumn=False )
    submit_widget = cmds.rowLayout(numberOfColumns=2, p=main)
    cmds.checkBox(label='Scout Job', p=submit_widget)
    cmds.button( label='Submit Job',width=130,align='right', p=submit_widget)
    cmds.showWindow()
    

    EDIT : here were the layouts highlighted from

    Not getting expected output in Maya python scripting for gui enter image description here