title: How to retrieve the word before space from text widget of tkinter each time space is pressed
body: <p>I am trying to retrieve the word before  everytime space is entered. For example, If a user types " iam a" i want to retrieve "iam" and then if user types "iam a girl" i want to retrieve "a" . </p>
  
  <p>Following is my code: </p>
  
  <pre><code>import tkinter as tk
  import time
  
  class ExampleApp(tk.Tk):
      def __init__(self):
          tk.Tk.__init__(self)  
  
          lsum = tk.Label(self,borderwidth=2,text="suggestions")
          lsum.grid(row=2, column=5, sticky=tk.W)
  
  
          def func3():
              contents = self.text.get("1.0", tk.END)
              lsum["text"] = contents
  
  
  
          def func4():
              self.text.bind("&lt;space&gt;",func3())
  
  
  
  
  
          self.text= tk.Text(self, height=5, width=30,borderwidth=2)
          self.text.pack(side=tk.RIGHT)
          self.text.grid(row=0, column=4)
          self.text.insert(tk.END, "")
  
  
  
          self.v = tk.IntVar()
          self.d = tk.IntVar()
          self.e = tk.IntVar()
          self.radio1=tk.Radiobutton(self, text="آيک گرآم مآڈل ", variable=self.v, value=1,command=func2).grid(column=0,row=1,columnspan=2)
          self.radio2=tk.Radiobutton(self, text="دو گرآم مآڈل ", variable=self.d, value=2,command=func3).grid(column=0,row=2,columnspan=2)
          self.radio3=tk.Radiobutton(self, text="تین گرآم مآڈل", variable=self.e, value=3).grid(column=0,row=3,columnspan=2)
  
  
  if __name__ == '__main__':
  
  
      run = ExampleApp()
      run.mainloop()
  </code></pre>
  
  <p>Kindly Help please. </p>