[Tutor] Newbie-Getting input from a text entry

alan.gauld@bt.com alan.gauld@bt.com
Mon, 26 Aug 2002 12:07:45 +0100


> I am trying to retrieve a value from a text box. 

I don't think you are....

>      print self.code.get()
> AttributeError: 'NoneType' object has no attribute 'get'

Says that self.code is a 'nonetype' object, not a text box.

>          self.code=Pmw.EntryField(self.root).grid(row=0,... 

You are storing the retirn value from the grid method in 
self.code.  But the return is none.

You need to separate the steps:

self.code = Pmw.EntryFoeld(self.root)
self.code.grid(....)

IMHO Its a shame the layout manager metjods don't 
return self but they don't so you have to use a two 
stage approach if you want to keep a handle to the 
widget...

HTH,

Alan g