Short answer:  Maya fail.

Longer answer:  Maya likes to attach additional values to its GUI callbacks.

You can fix this by redefining your defs as such:

def addStartNode(self, *_cb_vals):
    print _cb_vals
    [..]

Otherwise, looks good.  :D

hoaf

On Tue, Aug 2, 2011 at 4:39 AM, Ehsan Kiani <[email protected]>wrote:

> Hey guys,
>
> I got a prob with this code below :*
>
> # CLASS TEMP #
> # Temp class contains the functions which we will use in subclasses
> # Therefore most of essential methods are included here ...
> # ---------------------------------------------------------
>
> # modules
> import maya.cmds as mcs
> #import vrf_utilities as vu
>
> # we use new type classes
> __metaclass__ = type
>
> class Temp():
>
>     # attributes
>
>     # addStartNode fn #
>     def addStartNode(self):
>         # adds a node for starting a rig from
>         selList = mcs.ls(sl = True)
>         try:
>             mcs.textField(self.at_selNodeTxt, e = True, tx = selList[0])
>
>         except:
>             print 'Please select at least one start node'
>
>     # armLegTempUI fn #
>     def armLegTempUI(self, part):
>         # creates UI for arm, leg type temps
>         if mcs.window('at_win', exists = True):
>             mcs.deleteUI('at_win', window = True)
>             #mcs.windowPref('at_win', remove = True)
>
>         at_win = mcs.window('at_win', t = ('VRF ' + part + ' TEMP RIG'),
> rtf = True, sizeable = False)
>         at_mianCol = mcs.columnLayout(adj = True)
>
>         at_selRow = mcs.rowLayout(adj = True, nc = 2)
>         self.at_selNodeTxt = mcs.textField()
>         mcs.button(l = 'Add Start', w = 112, c = self.addStartNode)
>
>         mcs.setParent(at_mianCol)
>
>         at_nameFL = mcs.frameLayout(l = 'Naming', borderStyle = 'in', cll =
> True)
>         at_nameRow = mcs.rowLayout(adj = True, nc = 3)
>         self.at_perfixF = mcs.textFieldGrp(l = 'Perfix: ', text = 'perfix',
> cw2 = (35, 130), cl2 = ('left', 'left'))
>         self.at_nameF = mcs.textFieldGrp(l = 'Part: ', text = 'part', cw2 =
> (35, 130), cl2 = ('left', 'left'))
>         #at_suffixF = mcs.textFieldGrp(l = 'Suffix: ', text = 'suffix', cw2
> = (35, 70), cl2 = ('left', 'left'))
>
>         mcs.setParent(at_mianCol)
>
>         at_charTypeFL = mcs.frameLayout(l = 'Creature', borderStyle = 'in',
> cll = True, visible = True)
>         self.bipQuad = mcs.radioButtonGrp(l = '', labelArray2=['Biped ' +
> part, 'Quadruped ' + part], numberOfRadioButtons = 2 \
>         , sl = 1, cw3 = (45, 150, 150), cl2 = ('left', 'left'))
>
>         mcs.setParent(at_mianCol)
>
>         at_sideFL = mcs.frameLayout(l = 'Side', borderStyle = 'in', cll =
> True)
>         self.side = mcs.radioButtonGrp(l = '', labelArray3=['R', 'L', 'R -
> L'], numberOfRadioButtons = 3 \
>         , sl = 1, cw4 = (45, 110, 110 , 110), cl3 = ('left', 'left',
> 'left'))
>
>         mcs.setParent(at_mianCol)
>
>         at_typeFL = mcs.frameLayout(l = 'Type', borderStyle = 'in', cll =
> True)
>         self.singleDouble = mcs.radioButtonGrp(l = '', labelArray2=['Single
> Elbow', 'Double Elbow'], numberOfRadioButtons = 2 \
>         , sl = 1, cw3 = (45, 150, 150), cl2 = ('left', 'left'))
>
>         mcs.setParent(at_mianCol)
>
>         at_inheritFL = mcs.frameLayout(l = 'Inheritance', borderStyle =
> 'in', cll = True, vis = True)
>         self.inheritance = mcs.radioButtonGrp(l = '', labelArray2=['R >
> Transfer > L', 'L > Transfer > R'], numberOfRadioButtons = 2 \
>         , sl = 1, cw3 = (45, 150, 150), cl2 = ('left', 'left'))
>
>         mcs.setParent(at_mianCol)
>
>         at_createFL = mcs.frameLayout(l = 'Create', borderStyle = 'out',
> cll = True)
>         mcs.rowLayout(adj = True, nc = 3)
>         self.scaleTemp = mcs.intFieldGrp(l = 'Scale Temp: ', value1 = 1,
> cw2 = (61, 50))
>         mcs.button(l = '1) Create Temp', w = 130)
>         mcs.button(l = '2) Setup LRA', w = 90)
>
>         mcs.setParent(at_mianCol)
>
>         mcs.showWindow(at_win)
>
>
>
> at = Temp()
> at.armLegTempUI('Arm')*
>
> And the error I get is :
>
> *# Error: addStartNode() takes exactly 1 argument (2 given) *
>
> *# TypeError: addStartNode() takes exactly 1 argument (2 given) # *
>
> I was wondering if you could tell me why this happens ?
> Please check the green line and how I used the* c = self.addStartNode !*
>
> Best regards,
> --------------------------------------------
> Ehsan Kiani
> Character TD
> http://vimeo.com/user2219426
> Mobile: +98 918 936 9006
> [GMT: +3:30 hrs]
> Iran
> --------------------------------------------
>
> --
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings:
> http://groups.google.com/group/python_inside_maya/subscribe
>

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to