MCPcopy Index your code
hub / github.com/python/cpython / validate

Method validate

Lib/tkinter/simpledialog.py:306–337  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

304 return self.entry
305
306 def validate(self):
307 try:
308 result = self.getresult()
309 except ValueError:
310 messagebox.showwarning(
311 "Illegal value",
312 self.errormessage + "\nPlease try again",
313 parent = self
314 )
315 return 0
316
317 if self.minvalue is not None and result < self.minvalue:
318 messagebox.showwarning(
319 "Too small",
320 "The allowed minimum value is %s. "
321 "Please try again." % self.minvalue,
322 parent = self
323 )
324 return 0
325
326 if self.maxvalue is not None and result > self.maxvalue:
327 messagebox.showwarning(
328 "Too large",
329 "The allowed maximum value is %s. "
330 "Please try again." % self.maxvalue,
331 parent = self
332 )
333 return 0
334
335 self.result = result
336
337 return 1
338
339
340class _QueryInteger(_QueryDialog):

Callers

nothing calls this directly

Calls 2

showwarningMethod · 0.80
getresultMethod · 0.45

Tested by

no test coverage detected