PozestStar
12-08-2012, 12:06 AM
I feel so silly asking this question. I'm sure it has a simple answer, but I really don't know what it is.
Here's a bareboned example of what I'm trying to do.
Enter the values, press the button, create a cube. The problem is, I can't create a cube with the updated information in my fields. I'd like to avoid doing "mc.intField("n", query = True, value = True)" in the makeCube section if I can, but I'm not sure how else I can get the updated values in my fields.
Thanks.
import maya.cmds as mc
def exampleWin():
try: mc.deleteUI("exampleWin")
except: pass
win = mc.window("exampleWin", title = "Help me!")
layout = mc.rowLayout(nc = 4)
nameField = mc.textField("n", text = "bobTheCube")
widthField = mc.intField("w")
heightField = mc.intField("h")
name = mc.textField("n", query = True, text = True)
width = mc.intField("w", query = True, value = True)
height = mc.intField("h", query = True, value = True)
doButton = mc.button(label = "Create Cube!", command = lambda x:makeCube(name, width, height) )
mc.showWindow(win)
def makeCube(name, width, height, *args):
mc.polyCube(name = name, width = width, height = height)
Here's a bareboned example of what I'm trying to do.
Enter the values, press the button, create a cube. The problem is, I can't create a cube with the updated information in my fields. I'd like to avoid doing "mc.intField("n", query = True, value = True)" in the makeCube section if I can, but I'm not sure how else I can get the updated values in my fields.
Thanks.
import maya.cmds as mc
def exampleWin():
try: mc.deleteUI("exampleWin")
except: pass
win = mc.window("exampleWin", title = "Help me!")
layout = mc.rowLayout(nc = 4)
nameField = mc.textField("n", text = "bobTheCube")
widthField = mc.intField("w")
heightField = mc.intField("h")
name = mc.textField("n", query = True, text = True)
width = mc.intField("w", query = True, value = True)
height = mc.intField("h", query = True, value = True)
doButton = mc.button(label = "Create Cube!", command = lambda x:makeCube(name, width, height) )
mc.showWindow(win)
def makeCube(name, width, height, *args):
mc.polyCube(name = name, width = width, height = height)
