Title: Signature.html
The program I'm modifying uses something of a primitive way to check the validity of values entered into widgets on a larger dialog. It uses try-except after the user has pressed OK and departed from the dialog. Isn't this supposed to be done in the apply method for the dialog?

A typical data widget inside the  set operations dialog class is:

class OperationalSettingsDialog(tkSimpleDialog.Dialog):

    def __init__(self, parent, sdict):
        self.sdict = sdict
        tkSimpleDialog.Dialog.__init__(self, parent)
       
    def body(self,master):
        self.title("Operational Settings")
             ...
         # data widget
        Label( master, text="Max Hourly Event Rate: ").grid(row=5, sticky=W)
        self.rateVar = StringVar()
        Entry(master, width=10, textvariable=self.rateVar).grid(row=5, column=1)
        self.rateVar.set( "%s" % self.sdict["hourly_rate"] )
             ...
    def apply(self):
        self.sdict["ok"] = True
    #END of class

Furthermore, doesn't the use of tkSimpleDialog.Dialog provide an OK and Cancel button, which upon use causes the the invocation of the apply method to depart?
--
           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