Entry widget bind problems

vector Vector180W at netscape.net
Wed Apr 2 02:37:14 CEST 2003

PythonWin 2.2.2

Im a little confused with an entry widget bind. I had it working b4 but 
In an attempt to tidy up the code I have confused the class/callback 
reference or something.
As you can see from the text below, there is a MyFrame instance which 
builds the TK Gui window, in which a frame contains an entry widget. 
after typing in text into the entry widget a <return> event(enter key) 
is supposed to run the doEntry, but all i get this error.
what am i doing wrong?

    p=page.get()       #gets all text
AttributeError: Event instance has no attribute 'get'
def doEntry(page,*args):
     """Gets text from Entry widget on <enter> hit"""
     p=page.get()       #gets all text
     print p              #print it
     page.delete(0,END)        #clear entry widget

def entry(self,side,initTxt):
     """Make simple entry widget.Requires initial text"""
     self.entrVar = StringVar()      #assign variable
     w=Entry(self, relief=SUNKEN,textvariable=self.entrVar,
     #w.bind('<Return>',doEntry,self)	#tried to bind it here too
     w.pack(side=side, expand=YES,fill=BOTH)
     return w

class MyFrame(Frame):
     def __init__(self,master):

ALSO	tried

More information about the Python-list mailing list