title: Bind a function to multiple dynamically created buttons in kivy?
body: <h2>Problem</h2>
  
  <p>I want to create multiple buttons and bind them to a function. The problem is that whenever I click on one button, the function is called multiple times. It seems to be a problem with the event connection. When I look at the instance that called the function when I pressed a button, it seems that the function gets called from every button at once?!</p>
  
  <h3>KV Code:</h3>
  
  <pre><code>...
  # This is the button that I'am using
  &lt;ProjectSelectButton&gt;:
  height: 35
  background_color: 0,0,1,1
  on_touch_down: self.click_on_button(args[0], args[1])
  
  ...
  
  # The buttons are added to this grid
  ButtonsPlacedHere@GridLayout:
      id: active_projects
      cols: 1
      size_hint_y: None
      height: self.minimum_height
      spacing: 1
  ...
  </code></pre>
  
  <h3>Python Code:</h3>
  
  <pre><code>...
  class ProjectSelectButton(Button):
      def click_on_button(self, instance, touch, *args):
          print(instance)
          if touch.button == 'right':
              print(self.id, "right mouse clicked")
          else touch.buttom == 'left':
              print(self.id, "left mouse clicked")
  
  ...
  
  # The part of my programm that creates the buttons
  # projects is a dictionary
  for key, project in data_manager.resource_pool.projects.items():
      print(project.project_name)
      button= ProjectSelectButton(text=project.project_name, id=key, size_hint_y=None)
      # Bind without KV-File (same result)
      # label.bind(on_touch_up=self.click_on_button)
      ids.active_projects.add_widget(button)
  </code></pre>
  
  <h3>Example Output:</h3>
  
  <p>What I get, when I click on a single button!</p>
  
  <pre><code>&lt;guiMain.ProjectSelectButton object at 0x0BA34260&gt;
  ID01 right mouse clicked
  &lt;guiMain.ProjectSelectButton object at 0x0BA34260&gt;
  ID01 right mouse clicked
  &lt;guiMain.ProjectSelectButton object at 0x0BA28F10&gt;
  ID02 right mouse clicked
  &lt;guiMain.ProjectSelectButton object at 0x0BA28F10&gt;
  ID02 right mouse clicked
  &lt;guiMain.ProjectSelectButton object at 0x0BA22C00&gt;
  ID03 right mouse clicked
  &lt;guiMain.ProjectSelectButton object at 0x0BA22C00&gt;
  ID03 right mouse clicked
  </code></pre>
  
  <p>What I want when I press for example the button with ID 01:</p>
  
  <pre><code>&lt;guiMain.ProjectSelectButton object at 0x0BA34260&gt;
  ID01 right mouse clicked
  </code></pre>
  
  <h2>Question</h2>
  
  <p>How do I create multiple buttons which will call a single function when they are pressed?</p>