A Dangling Tk Entry

W. eWatson notvalid2 at sbcglobal.net
Sun Mar 8 22:34:48 EDT 2009


I'm looking at some Tk code written by someone else, and am curious about a 
methodology in the code. A setup object called SetDlg contains to code to 
set up parameters for some widgets for a dialog of radio buttons, 
checkboxes, and text/string entries. It then calls ShowDlg. After it returns 
in resets any new values entered for parameters. It's return is entry, which 
is of class Entry. The curious code is in ShowDlg. It looks like

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



-- 
                                W. eWatson

              (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
               Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet

                     Web Page: <www.speckledwithstars.net/>




More information about the Python-list mailing list