Message 1 of 1
Can I edit the numberOfDivisions of a formLayout once initialized via Maya Python command api?

Not applicable
10-04-2020
10:36 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I want to change the numberOfDivisions of a formLayout via Maya Python command api. It seems straightforward, but you can try it yourself with this simple chunk of code:
import maya.cmds as cmds
# Initialization.
w = cmds.window()
f = cmds.formLayout(numberOfDivisions=5)
b = cmds.button()
# Edit number of divisions from 5 to 10.
cmds.formLayout(f, edit=True, numberOfDivisions=10)
# Attach the button to it.
# NOTE - The program should die here.
cmds.formLayout(f, edit=True, attachPosition=[(b, 'top', 5, 0),(b, 'right', 5, 10)])
# The program should not reach here.
cmds.showWindow(w)