pstatix
pstatix

Reputation: 3848

Overriden class method throwing TypeError (missing 'self')

I need to replace a method class wide, from what I found, this was the way to do it:

from kivy.core.window import Window

def maximize_(self):
    # do things

Window.maximize = maximize_

Later when I call Window.maximize(), throws:

TypeError: maximize_() missing 1 required positional argument: 'self'

There is only ever 1 Window in a kivy application, so I just need to replace this function entirely.

Upvotes: 0

Views: 61

Answers (1)

ddg
ddg

Reputation: 1098

Kivy window methods are static. Assuming you do not use the self parameter of maximize_ within the function, I would remove the parameter.

from kivy.core.window import Window

def maximize_():
    # do things

Window.maximize = maximize_

Upvotes: 2

Related Questions