title: _tkinter.TclError: bad listbox index "": must be active, anchor, end, @x,y, or a number
body: <pre><code>from tkinter import *
  window_main = Tk()
  
  def window_open():
      def chgColor(event):
      lst["bg"] = lst.get(lst.curselection())
  
      window_public = Tk()
      window_public.title("New Page")
      lbl = Label(window_public, text = "Today is a good day and I'm a gooie!")
      lbl.grid(padx = 20, pady = 10)
      var = StringVar()
      lst = Listbox(window_public, height = 5, width = 10, listvariable = var)
      lst.grid(padx = 50, pady = 20)
      list = ["red", "blue", "yellow", "pink", "green", "white", "black"]
      var.set(tuple(list))
      lst.bind("&lt;&lt;ListboxSelect&gt;&gt;", chgColor)
      window_public.mainloop()
  
  
  window_main.title("Main")
  window_main_btn = Button(window_main, text = "To New Page", command = window_open)
  window_main_btn.grid(padx = 50, pady = 20)
  window_main.mainloop()
  </code></pre>
  
  <p>Error: </p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\ComputerSoftware\python3.6\lib\tkinter\__init__.py", line 1699, in __call__
      return self.func(*args)
    File "C:/Users/Shawn/PycharmProjects/gammaC@meL/gamma1.py", line 7, in chgColor
      lst["bg"] = lst.get(lst.curselection())
    File "C:\ComputerSoftware\python3.6\lib\tkinter\__init__.py", line 2792, in get
      return self.tk.call(self._w, 'get', first)
  _tkinter.TclError: bad listbox index "": must be active, anchor, end, @x,y, or a number
  </code></pre>
  
  <p>I'm a beginner in python and  got stuck with a problem. When I click on the button I go to a new page. Then when I click on listbox I get a traceback. I can't understand the traceback's meaning and can't fix it. <br> But I found out that when I delete codes about <em><code>window_main</code></em>, it runs. <br></p>