Skip to content Skip to sidebar Skip to footer

Python: __init__() Takes 2 Positional Arguments But 3 Were Given

I'm trying to create a simple UI with Tkinter and I have run into a problem. My code looks like this: class UIController(tk.Tk): def __init__(self, master=None): tk.Fra

Solution 1:

I think this is the line that is causing the issue, you cannot pass the self instance to the constructor.

frame = F(self, container)

Can you please check and add more information to the question to understand what you are trying to achieve.

Solution 2:

You can just add in __init__ one more argument, controller.

This works for me:

def__init__(self, master, controller):
    tk.Frame.__init__(self, master)

Post a Comment for "Python: __init__() Takes 2 Positional Arguments But 3 Were Given"