title: Python / Tkinter listbox troubles
body: <p>I posted a question <a href="https://stackoverflow.com/questions/14467604/python-tkinter-listbox-event-binding">here</a> and I was advised to restructure the code. It's now different enough that I feel it justifies asking a new question. </p>
  
  <p>Anyway, I'm trying to add drag/drop functionality to a listbox, but I figured a good first step would be to get the event binding working in the first place. Currently, when I click on the list I get the following error upon clicking the listbox. The listbox window appears, but when I click it the error occurs. </p>
  
  <pre><code> "AttributeError: make_list instance has no attribute 'nearest'.
  </code></pre>
  
  <p>Also, when I print listbox in the build_listbox method, the following decimal is printed .40720520L. Shouldn't this print the values in the listbox? Afterall, it's in the same method. Is the listbox not being created properly?</p>
  
  <pre><code>from Tkinter import *
  import Tkinter
  
  class make_list:
  
      def move_mouse(self, event):
          self.curIndex = event.nearest(event.y)
          print self.curIndex
  
      def click_button(self, event):
          w= event.widget
          self.curIndex = int(w.curselection()[0])
          #print self.curIndex
          value = w.get(self.curIndex)
          print value
  
      def build_main_window(self):
          self.build_listbox()
  
      def build_listbox(self):
          listbox = Listbox()
          listbox.bind('&lt;&lt;ListboxSelect&gt;&gt;', self.click_button)
          listbox.bind('&lt;B1-Motion&gt;', self.move_mouse)
          for item in ["one", "two", "three", "four"]:
              listbox.insert(END, item)    
          listbox.insert(END, "a list entry")
          listbox.pack()
          print listbox
          return
  
  if __name__ == '__main__':
      start = make_list()
      start.build_main_window()
      mainloop()
  </code></pre>