title: Multiple listboxes in python dynamically with Tkinter
body: <p>I am a beginner in Python.
  I wanted to create multiple listboxes and read the entries from the listboxes. The number of list-boxes depends on the size of the list named "result" defined at the start of the code. The length of the list "result" is not a constant. Depending on the selections made in the listboxes further operations need to be formed. </p>
  
  <p>The code I ended up is like:</p>
  
  <pre><code>result = ['Weekly','Monthly',Annual]
  class Application(Frame):
  
  def __init__(self,master):
      Frame.__init__(self,master)
      self.grid()
      self.create_widgets()
  
  def create_widgets(self):
      for inst in result:
  
  
  
          textenter = "Select the required output format" + inst
  
          self.Label[inst] = Label(self,text = textenter)
          self.Label[inst].grid(columnspan = 2, sticky = W)
  
          self.Listbox[inst] = Listbox(self, selectmode = MULTIPLE,exportselection = 0)
          self.Listbox[inst].grid(sticky = W)
  
  
          for items in ["Text","XML","HTML"]:
              self.Listbox[inst].insert(END,items)
  
  
  
      self.submit_button = Button(self, text = "Submit",command = self.returns)
      self.submit_button.grid(row = 7, column = 1, sticky = W)
  
      self.content = []
  
  
  
  def returns(self):
      for inst in result:
          self.content.append(self.Listbox[inst].curselection())
          print self.content
  
  
      self.master.destroy()    
  
  
  root = Tk()
  
  app = Application(master = root)
  root.title("Output Formats")
  app.mainloop()
  print app.content
  </code></pre>
  
  <p>I get only one listbox with this code but I get the selected number of labels
  I am stuck after this point. Couldn't get any further. Please help me. Thanks in advance. Please let me know if the info is not clear. I am open to a completely new code as well.</p>