[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 
>        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 

       self.txt_box = Entry(self, text = "hool")

> 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.


Alan Gauld
Author of the Learn to Program web site

More information about the Tutor mailing list