As I thought this over, while on a long walk, apply might not be the
place. That is, if pressing OK gets you to apply and the code discovers
how do you get back to the dialog. I think you may have answered that
below with the validation code.
Alan Gauld wrote:
"Wayne
Watson" <sierra_mtnv...@sbcglobal.net>
wrote
Yes, apply is invoked when I click OK. apply
has one statement,
and returns to the caller, which then checks the validity (try-except)
of values passed back to it. It seems like apply should do all the
try-except work instead.
Yes, I'd agree that is how it should work.
What I really need are checks like is lat
(latitude) from -90 to +90,
and not -700, say. That is bound checking.
Yes, that can be done with binding of validation code to the lat field.
You could also use the FocusOut event for example to run something
like:
# in the create widget section....
self.lat.bind('<FocusIn>', self.vLat)
# validation handler
def vLat(self, ev):
if 90 < int(self.lat.get()) < -90:
# beep, or error dialog
self.lat.focus_set()
Which would generate an alert and reset focus to the widget before
even hitting apply().
HTH,
--
Signature.html
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