I know this is stupid, but I don't know. I can't figure out method as decorator. I have 2 classes: 1 Button and 1 child Button. I want to play a sound when the button is clicked. So there is a call function in the Button class.
class Button:
def __call__(self):
print("play")
Now in the child class, I want the button to do something, but I still want to play the sound. If I override the call function, the play sound part will disappear.
class ChildButtonn(Button):
def __call__(self):
# button things but the sound is gone
# I need to write the play thing again here
print("play")
So how to do that?