I tried to call press_space() while pressing space key in Text widget but massage error say 'NoneType' object has no attribute 'bind' i used python 2.7
import nltk
root=Tk()
txt=Tkinter.Text(root,font=('arial',30,'bold'),bd=5, bg="grey",foreground="red",width="31",height="5").grid(columnspan=50,rowspan=30, column=0)
txt.bind('<space>', press_space)
def press_space():
print ('Hello world')