title: Kivy- different attributes for for loop generated buttons
body: <p>I have been trying to make multiple buttons according to the number of files in a directory. And when each button pressed it should start to launch a different video file. I have for samples so far i can create 4 buttons but when i pressed it always triggers the last buttons on_release function. I have tried the make an array of buttons and they would have different instances but didn't succeed. Tried to get the id of the buttons but when i tried returning widget.id in a different function it returned the all the 4 buttons id's. </p>
  
  <p>Is there any clear way to handle this kind of stuff. I would prefer to work with kivy file but i couldn't figure it out how to create buttons in a for loop. I can share the full code and kivy files also but it would be so messy. Let me know if you need more info. </p>
  
  <p>Thanks in advance.</p>
  
  <pre><code>def createMultipleButton(self, dt):    
      root = Widget()
      size_y=150;
      size_x=150;
  
      for i in range(1):
      folderList = os.listdir(picture_path)
      if len(folderList)==0:
          time.sleep(1)
          break
      fileList = os.listdir(picture_path)
      print fileList
  
      for file in fileList:
  
              x = (picture_path+"/"+file)
  
              button = Button(id=str(file),text="" + str(file),size_hint=(None, None),height=size_y,width=size_x, pos_hint={'x': 0, 'y': 1},background_normal=x)
              button.bind(on_release=lambda btn:self.VideoContainer(str(file))        
  
  
              print file
              self.scrollview.content_layout.add_widget(button)
  
  
  def VideoContainer(self,name):
  
      mylist=name.split('.')
      video = VideoPlayer(source="/home/linux/kivyFiles/kivyLogin/videoAssets/"+mylist[0]+".mp4", play=True)
      video.allow_stretch=True
      video.size=(500,500)
      video.pos=(400,400)
      self.add_widget(video)
  </code></pre>