A Dangling Tk Entry

r rt8396 at gmail.com
Mon Mar 9 03:47:42 CET 2009

On Mar 8, 9:34 pm, "W. eWatson" <notval... at sbcglobal.net> wrote:

> Radiboutton(master, textvariable = ...
> Radiobutton(msster, textvariable = ...
> Checkbox(master, text=...
> entry = Entry(master, width=10, ...
> entry.insert(0,self.slowdown)    # testing a default methodology
> Label( master, text="Max...
> Entry(master, width=10, textvar...
> ...
> return entry
> First, what is the meaning of entry=Entry(...? That is, other than create an
> Entry, why that particular position, and why not with say Checkbox?

It sounds like you don't understands some fundamentals of Tkinter
programming. You only need to create a reference(instance) to a tk
widget if you plan to access it later. Widgets like labels (in some
cases) will never change, so creating an instance is just furturing
your capal tunnel avancment. :). Checkbuttons and Radiobuttons use
Variables to query thr widget so they also do not need to be

Something else that you need to understand, You must explicitly  pack
(), place(), or grid() a widget instance if you wish to call that
instance later or you will get an error.

#-- this no work --#
entry = Entry(master).pack() #cannot call entry.method()

#-- this works --#
entry = Entry(master)

> Further,
> SetDlg has used ShowDlg by calling dialog=ShowDlg(( self.master, set_a...
> dialog is then used to get at the parameters set by the user. I thought I'd
> give ShowDlg an attribute by using entry.insert(0,self.slowdown inserting it
>   before return. Upon return from ShowDlg, which was invoked by, dialog =
> ShowDlg( self.master, set_a ..., I thought I'd grab slowdown with x=
> dialog.slowdown. The program didn't get that far, so, second, I'd like to
> know why it died on the insert statement? That line, produced 'NoneType'
> object has no attribute 'insert' , and entry and its type are None and >type
> 'NoneType'> What has gone wrong?

I would suspect a geometry manager issue here but you really should
post all the code for this dialog.

More information about the Python-list mailing list