title: Kivy how to give all objects same basic functionality
body: <p>Lets say I create a custom Button class called MyButton. I want all created MyButtons to play the same sound when they are pressed. But I also want to add different functionality for specific buttons, for example I want some buttons to change label text, but I also want them to play that sound. Is there a way to do it with inheritance so I don't have to keep in mind that I have to add play sound functionality to every created button?</p>
  
  <p>EDIT: Lets say I have a class MyButton declared as bellow:</p>
  
  <pre><code>class MyButton(Button):
  
      def generic_function_for_all_buttons(self):
          print('GENERIC FUNCTION')
  </code></pre>
  
  <p>now when I try to create a MyButton somewhere else in the code like this:</p>
  
  <pre><code>class TestClass(BoxLayout):
      def __init__(**kwargs):
          self.buttons = []
          self.set_layout()
  
      def button_action(self,button):
          button.generic_function_for_all_buttons()
          print(button.text)
  
      def set_layout(self):
          for i in range(0,100):
              button = MyButton(text=i)
              button.on_press = functools.partial(button_action, button)
              self.buttons.append(button)
              self.add_widget(button)
  </code></pre>
  
  <p>This is not runnable code, just a demonstration of what I want to achieve. Now each time I press MyButton from TestClass, it prints GENERIC FUNCTION and a number between 0-99 based on which button was pressed. But I had to add button.generic_function_for_all_buttons() line and I want to avoid it if possible. If each of the 100 buttons had its own different action like this:</p>
  
  <pre><code>def action_1(self,button):
      button.generic_function_for_all_buttons()
      print('1')
  def action_2(self,button):
      button.generic_function_for_all_buttons()
      print('2')
  def action_3(self,button):
      button.generic_function_for_all_buttons()
      print('3')
  ...
  </code></pre>
  
  <p>That button.generic_function_for_all_buttons() is 100 lines of code I want to avoid. I thought it must be possible somehow with inheritance,e.g I add on_press method to MyButton class like this:</p>
  
  <pre><code>class MyButton(Button):
  
      def on_press(self):
          print('GENERIC FUNCTION')
  </code></pre>
  
  <p>but then it simply ignores it.</p>