title: How can I update a tkinter Label with every new selection in Listbox?
body: <p>I would like the labels on the right side to update when a name in the list box is selected. When a new name in the list is selected, the name label on the right remains the same.</p>
  
  <p>I tried <code>name_list.index(ACTIVE)</code> directly within student_name.set() as <code>student_name.set(students_list[name_list.index(ACTIVE)].get_name())</code>.  I'm afraid that it is just using index 0 and not even using active selection.</p>
  
  <pre><code>from tkinter import *
  
  # Defining Student class
  class Student:
  
    def __init__(self, name, instrument=""):
      self.name = name
      self.instrument = instrument
  
    def get_name(self):
      return self.name
  
    def get_instrument(self):
      return self.instrument
  
  # Creating Student objects and list
  s1 = Student("Seth", "Trumpet")
  s2 = Student("Cassie", "Flute")
  s3 = Student("Cody", "Guitar")
  students_list = [s1, s2, s3]
  
  # GUI created
  def make_window():
    rootWindow = Tk()
    rootWindow.title("Instructor Database Application")
    rootWindow.grid()
  
    frame0 = Frame(rootWindow)
    frame0.grid(column=0, row=0, padx=20, pady=20)
  
    name_list = Listbox(frame0, height=10)
    name_list.grid(column=0, row=0)
    for Student in students_list:
      name_list.insert(END, Student.get_name())
  
    frame1 = Frame(rootWindow)
    frame1.grid(column=1, row=0, padx=20, pady=20)
  
    student_index = name_list.index(ACTIVE)
    student_name = StringVar()
    student_name.set(students_list[student_index].get_name())
  
    name_label = Label(frame1, textvariable=student_name)
    name_label.grid(column=0, row=0)
  
    instrument_label = Label(frame1, text="Instrument")
    instrument_label.grid(column=0, row=1)
  
    return rootWindow
  
  def main():
    app = make_window()
    app.mainloop()
  
  main()
  </code></pre>
  
  <p>The program begins with the first name and is unable to change. Any advice?</p>