title: Getting the text of label once button is clicked (Tkinter)
body: <p>I am new to Python and Tkinter so I am trying to create a sample program to explore.</p>
  
  <p>The program basically shows the names as a Label then 4 buttons will be put right next to the Label.</p>
  
  <p>One of the buttons is "Delete" and what I want to do is, the button will get the name of the Label that is right next to that 'Delete" button.</p>
  
  <p>The code is :</p>
  
  <pre><code>from Tkinter import *
  
  class GUI():
      def __init__(self):
          self.namelist = ["Mark","Anna","Jason","Lenna",
                       "Leo","Zucharich","Robinson",
                       "AReallyLongNameThatMightExist"]
          self.canvas = Canvas(width=1200,height=700)
          self.canvas.pack(expand=YES,fill=BOTH)
  
      def Friends(self):
          frame = Frame(self.canvas)
          frame.place(x=600,y=300)
          #Frame for showing names of friends
          row = 0
          for x in self.namelist:
              label = Label(frame,text="%s "%x)
              chatButton = Button(frame,text="Chat")
              delButton = Button(frame,text="Delete")
              setcloseButton = Button(frame,text="Set Close")
              setgroupButton = Button(frame,text="Set Group")
              label.grid(row=row, column=0, sticky="W")
              chatButton.grid(row=row, column=1)
              delButton.grid(row=row, column=2)
              setcloseButton.grid(row=row, column=3)
              setgroupButton.grid(row=row, column=4)
              row = row + 1
          mainloop()
  
  GUI = GUI()
  GUI.Friends()
  </code></pre>
  
  <p>Example: If you run the code, then when you click "Delete" button next to "Mark", then the button will return "Mark".</p>
  
  <p>Thanks!</p>