小编Ran*_*Rex的帖子

Python TypeError:__ init __()为参数'master'获取了多个值

目前正试图在Python中构建一个GUI,特别是我坚持这个部分.每次我尝试运行我的代码时,它只会抛出错误TypeError: __init__() got multiple values for argument 'master'.我似乎无法找到我传递的价值超过一个值的地方,这让我摸不着头脑.我尝试搜索错误,但其他人列出的修复程序我看不到如何让它们与这个一起工作.任何指导都将非常感谢.请参阅以下代码示例:

class Plotter(tk.Canvas):
    """Creates a canvas for use in a GUI
    Plotter() -> Canvas
    """
    def __init__(self, master, **kwargs):
        super().__init__(self, master = master, **kwargs)
        self.bind("<Configure>", self.on_resize)
        self.height = self.winfo_reqheight()
        self.width = self.winfo_reqwidth()
        self.bg = 'white'
        self.relief = 'raised'

class AnimalDataPlotApp(object):
    """This is the top level class for the GUI, and is hence responsible for
    creating and maintaining instances of the above glasses
    """

    def __init__(self, master):
        """Initialises the window and creates …
Run Code Online (Sandbox Code Playgroud)

python tkinter python-3.x

3
推荐指数
2
解决办法
3915
查看次数

标签 统计

python ×1

python-3.x ×1

tkinter ×1