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.
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_
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.