I need to restrict the values in the Entry widget to numbers only. The way I implemented is: import numpy as np from Tkinter import *; import tkMessageBox; class window2: def __init__(self,master1): self.panel2=Frame(master1) self.panel2.grid() self.button2=Button(self.panel2,text="Quit",command=self.panel2.quit) self.button2.grid() self.text1=Entry(self.panel2) self.text1.grid() self.text1.bind('<KeyPress>', self.keybind1) self.text1.focus() def keybind1 (self,event): if event.int in np.linspace(0,9,10): print event.int root1=Tk() window2(root1) root1.mainloop() I keep getting error message that Event instance has no attribute 'int'. What should I do? Continue reading...