Skip to content
Advertisement

tkinter classes problem: __init__() got an unexpected keyword argument ‘master’

I am using customtkinter which is the exact same as tkinter but prettier.

how can I set the master of a tkinter frame class when the class inherits from the frame class in tkinter ??

my problem is because i want frame_right to be the master of wave_prop_inputs frame; which basically means, a frame inside a frame.

I tried using master=frame_right when making an object of the wave_prop_inputs class but that gave me the error init() got an unexpected keyword argument ‘master’

here is my main file:

JavaScript

and here is my 2nd file:

JavaScript

Advertisement

Answer

At this line you try to parse the keyword argument master:

JavaScript

To this class that does not expect any sort of arguments:

JavaScript

To enable this class to accept an argument with a default value you need to change it like this:

JavaScript

Last but not least you need to parse that value to your super class in order to make the super class use it.

JavaScript

You should take a look at a basic tutorial about OOP to benefit by this concept more. In addition I suggest you to use the PEP-8 (Python Style Guide) see naming convention for classes for example. Your class looks like a method for a regular python developer.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement