PozestStar
11-25-2012, 03:21 AM
I'm really showing my inexperience here, but I can't figure this out. I have three intFields that will need to use the same function. I have something like this:
def exampleWin():
win = mc.window(title = "Help me!")
layout = mc.rowLayout(nc = 4)
fieldOne = mc.intField("one", changeCommand = setOddInt)
fieldTwo = mc.intField("two", changeCommand = setOddInt)
fieldThree = mc.intField("three", changeCommand = setOddInt)
mc.showWindow(win)
def setOddInt(number):
oddInt = number/2*2+1
mc.intField(edit = True, value = oddInt)
It gives me this error: line 14: No object name specified.
I know why, it's because on line 14, I haven't specified which intField to edit the value of. I didn't do that because more than one intField needs to use this chunk of code.
I'm not sure how to make this able to be used by multiple intFields.
I'd appreciate any help you could give me.
Thanks
def exampleWin():
win = mc.window(title = "Help me!")
layout = mc.rowLayout(nc = 4)
fieldOne = mc.intField("one", changeCommand = setOddInt)
fieldTwo = mc.intField("two", changeCommand = setOddInt)
fieldThree = mc.intField("three", changeCommand = setOddInt)
mc.showWindow(win)
def setOddInt(number):
oddInt = number/2*2+1
mc.intField(edit = True, value = oddInt)
It gives me this error: line 14: No object name specified.
I know why, it's because on line 14, I haven't specified which intField to edit the value of. I didn't do that because more than one intField needs to use this chunk of code.
I'm not sure how to make this able to be used by multiple intFields.
I'd appreciate any help you could give me.
Thanks
