title: Python Tkinter: create a list with Entry, and send the list updated to another class
body: <p>My target is to make a GUI program, using Tkinter, that makes a window with one button, which opens another window in which there are two lables, that represent the coordinates x and y of some points that the user has to write. This coordinates must be inserted in a list (for exaple: [[0,1],[2,3],...). Then, I just want to draw these points in the canvas, whit the function create_oval.
  This is my code</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>from Tkinter import *
  import tkMessageBox, tkFileDialog
  
  
  class nodes(Frame):
      def __init__(self, master=None):
          Frame.__init__(self, master, relief=SUNKEN, bd=2)    
          
          self.root_nodes = Tk()
          self.root_nodes.geometry("200x150")
          
          self.lista=[]        
          Label(self.root_nodes, text="x: ").pack()
          self.x = Entry(self.root_nodes)
          self.x.pack()
          Label(self.root_nodes, text="y: ").pack()
          self.y = Entry(self.root_nodes)
          self.y.pack()
          self.ok = Button(self.root_nodes, text="OK", command=self.OK)
          Label(self.root_nodes, text="\n")
          self.ok.pack()
          self.fine = Button(self.root_nodes, text="END", command=self.end)
          self.fine.pack()
          
      def OK(self):     
          self.lista.append([float(self.x.get()),float(self.y.get())])
          
      def end(self):       
          return self.lista        
          self.root_nodes.destroy()
  
  
  
  class AppUI(Frame):
      def __init__(self, master=None):
          Frame.__init__(self, master, relief=SUNKEN, bd=2)
          
          def points():
              x = nodes()
              self.a = x.end()
              print self.a
  
          #here
         
          self.frame = Frame(root)
          self.point = Button(self.frame, text = "Points", command = points).pack()
          self.frame.pack(side =LEFT, fill =BOTH)
          self.canvas = Canvas(self, bg="white", width=400, height=400,bd=0, highlightthickness=0)
          #for i in range (0, len(self.a)):
              #self.canvas.create_oval(self.a[i][0] - 1 , self.a[i][1] - 1, self.a[i][0] + 1 , self.a[i][1] + 1)
          
          self.canvas.pack()
    
          try:
              self.master.config(menu=self.barra_menu)
          except AttributeError:
              # master is a toplevel window (Python 1.4/Tkinter 1.63)
              self.master.tk.call(master, "config", "-menu")
  
  
  root = Tk()
  root.geometry("400x400")
  
  miaApp = AppUI(root)
  miaApp.pack()
  root.mainloop()
  
  #here</code></pre>
  </div>
  </div>
  </p>
  
  <p>I have some questions:</p>
  
  <ol>
  <li>First of all: is this an elegant way to create and initialize windows with the classes? Because I saw many way to do that</li>
  <li>Obviously, when I print self.a in the AppUI, it prints an empty list, because in the previous class I initialized self.lista=[]! 
  So I need something that updates the variable self.lista, so that it can arrive whith all the points at AppUI</li>
  <li>Why if I click the button END in the root_nodes it doesn't destroy?</li>
  <li>Last thing: classes must "communicate", because I want my variable lista in many "places" of the code: of course in the class AppUI, where I put the canvas (the first #here), but also in the main body of the code (the second #here), because I must do some operation with it</li>
  </ol>
  
  <p>Thank you so much</p>