无法找到解决方法:正好接受 1 个参数(给定 2 个)

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

我最近遇到了 python,但我已经遇到了 '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):
        self.value += 1
        print self.value

感谢您的帮助。

编辑: 我在 Maya 的脚本编辑器中使用 class:

ButtonPress().buildUI()

然后我得到: 错误:__increaseAndPrint() 正好接受 1 个参数(给定 2 个) 当按下 UI 按钮时。

对不起。

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