[Tutor] Display in a text field using tkinter
Alan Gauld
alan.gauld at btinternet.com
Fri Apr 2 09:14:16 CEST 2010
"adedoyin adegoke" <doyennehoney at yahoo.com> wrote > def
create_widgets(self):
> Label(self, text = "Database Name:").grid(...
> self.txt_box = Entry(self, text = "hool").grid(...
The grid(and pack etc) method returns None.
You have to create the widgets then apply the layout manager on a separate
line
self.txt_box = Entry(self, text = "hool")
self.txt_box.grid(....)
>
> Exception in Tkinter callback
> self.txt_box.insert(END,trt)
> AttributeError: 'NoneType' object has no attribute 'insert'
>
> How can i correct this?
Don;t use grid() ion the same line as you create the widget.
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
More information about the Tutor
mailing list