简体   繁体   中英

How to change position of text in Maya Python

I am making gui in maya using python but i am new in that and i Don't know how to change positions of text in maya using python.

Code:

import maya.cmds as cmds

# Make a new window

window = cmds.window( title="Render", iconName='BTD', widthHeight=
(500,500),titleBar=True,minimizeButton=True,maximizeButton=True )
cmds.columnLayout( adjustableColumn=True)

form = cmds.formLayout()
tabs = cmds.tabLayout(innerMarginWidth=10, innerMarginHeight=10)
cmds.formLayout(form,edit=True,attachForm=((tabs, 'top', 0), (tabs, 'left', 
0), (tabs, 'bottom', 0), (tabs, 'right', 0)) )
child1 = cmds.rowColumnLayout(numberOfColumns=2)
cmds.button(label='1')
cmds.button(label='2')
cmds.button(label='3')  
cmds.setParent( '..' )


child2 = cmds.rowColumnLayout(numberOfColumns=1)
cmds.text("Output Directory",width = 50,height=50,font = "boldLabelFont")
cmds.text("Notify on job completion",width = 200,height=50,font = 
"boldLabelFont")
cmds.setParent( '..' )


child3 = cmds.rowColumnLayout(numberOfColumns=2)
cmds.button(label='7')
cmds.button(label='8')
cmds.button(label='9')
cmds.setParent( '..' )

cmds.tabLayout( tabs, edit=True, tabLabel=((child1, 'General'), (child2, 
'Advanced'),(child3, 'Job Software')) )
cmds.setParent( '..' )

cmds.showWindow( window )

Output

在此处输入图片说明

Expected Output

在此处输入图片说明

There are any concept like give x axis and y axis to text ?

Please tell me how to do formatting in maya using python

It is just the align attribute you have to add and it accepts one of left , right and center . If you don't set it, by default it is center

   cmds.text("Output Directory",width=50, height=50,font="boldLabelFont", align='left')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM