[Tutor] Fun with Label and Entry--Why NoneType?

Alan Gauld alan.gauld at btinternet.com
Wed Mar 18 03:04:26 CET 2009


"Wayne Watson" <sierra_mtnview at sbcglobal.net> wrote
> Unfortunately, that takes me back to the original situation. 
> That is, the blank window appears along with the dialog window. 

OK Try this version:

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

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)
        self.lat.grid(row=0, column=1)
        
        Label(master, text='Longitude:').grid(row=0, column=2)
        self.long=Entry(master, width=12)
        self.long.grid(row=0, column=3)
        self.master.withdraw()
            
    def apply(self):
        print "apply"
        print self.lat.get()
        print self.long.get()

print "setting"
lat=1.0
long=0.0

root = Tk()
DialogPrototype(root)



More information about the Tutor mailing list