import maya.cmds as mc, os
from functools import partialclass testclass():
def __init__(self,*args): if mc.window('win4',exists=1): mc.deleteUI('win4') mc.window('win4',title='3DreamLib Renamer') mc.columnLayout(parent='win4', bgc=[0.2, 0.2, 0.2]) self.txtFieldSuffix = mc.textField(w=100) mc.button(label = 'button1', c= partial(self.testFunc,arg = mc.textField(self.txtFieldSuffix,q=1,text=1))) if __name__ == "__main__": mc.showWindow('win4') def testFunc(self,event,arg): print ('argument is ',arg)
testclass()
I have a very simple class where I want to get the value of a text field and pass it on to the testFunc. But testFunc print statement prints no value for arg variable. Whatever I write in the textField never gets passed to testFunc. What am I doing wrong?