title: Listbox filtering using a combo box
body: <p>I'm trying to filter the content that is displayed in my listbox depending on the currently selected item of a combo box. I'm not sure how I can accomplish this and I have not found even a simple, plain example online. Any ideas? I'd really appreciate some help.</p>
  
  <p>Here are code excerpts. </p>
  
  <p>Listbox:</p>
  
  <pre><code>class MyListBox(object):
      def __init__(self, frame, listbox_header, listbox_list):
  
      self.tree = ttk.Treeview(frame, columns=listbox_header, show='headings')
      yScroll = ttk.Scrollbar(frame,orient='vertical', command=self.tree.yview)
      yScroll.pack(side=RIGHT, fill=Y)
      self.tree.config(yscrollcommand=yScroll.set)
      self.tree.pack(side=LEFT, fill=Y, expand=TRUE)
      for col in listbox_header:
          self.tree.heading(col, text=col.title(),command=lambda c=col: sortby(self.tree, c, 0))
      self.update_rows(listbox_list)
      self.tree.bind('&lt;Double-1&gt;', self.OnDoubleClick)
  
  def update_rows(self, listbox_list):
      items = self.tree.get_children()
      for item in items:
          self.tree.delete(item)
      for item in listbox_list:
          self.tree.insert('', 'end', values=item)
  
  def OnDoubleClick(self, event):
      item = self.tree.selection()[0]
      self.Info(self.tree.item(item, 'values'))
  
  #Single student information window. Display all courses in student listbox
  def Info(self, selected):
      info = Toplevel()
      info.title('Student Information: %s - %s - %s' % (selected[0], selected[1], selected[2]))
      info.geometry('%dx%d+%d+%d' % (WIDTH, HEIGHT, 50, 50))
  
      student = session.query(Student).filter_by(id=selected[0]).first()
  
      #Single student header label info
      Label(info, text='Total All Attempts: %s' % student.gpa).pack()
      Label(info, text='Total Best Attempts: %s' % student.best_gpa).pack()
      Label(info, text='Spec GPAs: %s' % student.rules_gpas).pack()
      Label(info, text='Spec GPAs Needed: %s' % student.rules_gpas_needed).pack()
  
      #Single Student course info list
      Label(info, text='\nAll Courses:').pack()
      current = session.query(Course.sid, Course.term, Course.subject, Course.number,
                              Course.title, Course.grade, Course.grade_val, Course.hours).\
          order_by(Course.term.desc(), Course.subject, Course.number, Course.grade_val.desc()).filter_by(sid=selected[0])
      course_header = ['ID', 'term', 'subject', 'number', 'title', 'grade', 'grade_val', 'hours']
  
      #setup listbox and scroll bars
      tree = ttk.Treeview(info, columns=course_header, show='headings')
      yScroll = ttk.Scrollbar(info, orient='vertical', command=tree.yview)
      yScroll.pack(side=RIGHT, fill=Y)
      tree.config(yscrollcommand=yScroll.set)
      tree.pack(side=LEFT, fill=BOTH, expand=TRUE)
  
      for col in course_header:
          tree.heading(col, text=col.title(), command=lambda c=col: sortby(tree, c, 0))
          tree.column(col, width=50, anchor='center')
      tree.column('title', width=150, anchor='w')
      for item in current:
          tree.insert('', 'end', values=item)
  </code></pre>
  
  <p>And here is the combo box:</p>
  
  <pre><code># This creates the drop menu (combobox)
  Label(top, text='View Concentration:').pack(side=LEFT)
  box_value = StringVar()
  box = ttk.Combobox(top, textvariable=box_value, state='readonly')
  titles = []
  titles.append('All')
  for rule in rules:
      titles.append((rule.title))
  box['values'] = titles
  box.current(0)
  box.pack(side=LEFT)
  </code></pre>