I'm trying to make a button in a function that calls another function inside a class.
That's what I did:
# button calling functions
import maya.cmds as cmds
import maya.mel as mel
from functools import partial
class B:
def __init__(self):
self.create_window()
def printText(self, text, *args):
print(text)
return
def create_window(self):
window = cmds.window()
cmds.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 50), (1, 70)])
cmds.text(label='Name')
axis = cmds.textField()
cmds.showWindow(window)
text_entered = cmds.textField(axis, query=True, text=True)
#cmd = 'printText("{0}")'.format(text_entered)
cmds.button(label="asd", command = partial(self.printText, text_entered))
return
a = B()
The problem is I get printed nothing. What am I doing wrong?
text_entered, you're printing an object - OneCricketeer