[Solved] Can’t find the fix for: takes exactly 1 argument (2 given)


import maya.cmds as cmds

class ButtonPress:

    def __init__(self):
        self.value = 0

    def buildUI(self):
        window = cmds.window(title="Press Button", w = 100, h = 50)
        columnL = cmds.columnLayout(w = 100, h = 50)
        cmds.button(parent = columnL, label="Press me", w = 100, h = 50, command = self.__increaseAndPrint)
        cmds.showWindow(window)

    def __increaseAndPrint(self, *args):
        # maya throwing through ui a default bool argument as last.
        # you need *args to catch and dismissed it
        self.value += 1
        print self.value

1

solved Can’t find the fix for: takes exactly 1 argument (2 given)