Title: Signature.html
The program below is derived from an example in Grayson for showing how one might a dialog for entering passwords. The structure seems just like the original, down to the use of self, Label and Entry plus . Yet the print "here" statement produces:
    here None <type 'NoneType'>
I'm missing something. The NoneType causes the print of the self.lat to fail with get().

The original returns something from the corresponding body function, but taking it out does nothing in either program. The original program is posted above under "Modifying Grayson's Example 5_14".

# Derived from Grayson 5_14.py
from   Tkinter import *
from   tkSimpleDialog import Dialog
import tkSimpleDialog
import tkMessageBox
#import Pmw

class DialogPrototype(Dialog):

    def body(self, master):
        self.title("Enter Site Data")
        Label(master, text='Latitude:').grid(row=0, sticky=W)
        self.lat=Entry(master, width=12).grid(row=0, column=1)
       
        Label(master, text='Longitude:').grid(row=0, column=2)
        self.long=Entry(master, width=12).grid(row=0, column=3)
        print "here", self.long,type(self.long)
        return
   
    def apply(self):
        print "apply"
        print self.lat.get()
        print self.long.get()

    print "setting"
    lat=1.0
    long=0.0

root = Tk()
root.withdraw()
dialog = DialogPrototype(root)
--
           Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

             (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time)


                Life is one damn thing after another."
                     -- Mark Twain 
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to