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

Method ok

Lib/idlelib/query.py:139–151  ·  view source on GitHub ↗

If entry is valid, bind it to 'result' and destroy tk widget. Otherwise leave dialog open for user to correct entry or cancel.

(self, event=None)

Source from the content-addressed store, hash-verified

137 return entry
138
139 def ok(self, event=None): # Do not replace.
140 '''If entry is valid, bind it to 'result' and destroy tk widget.
141
142 Otherwise leave dialog open for user to correct entry or cancel.
143 '''
144 self.entry_error['text'] = ''
145 entry = self.entry_ok()
146 if entry is not None:
147 self.result = entry
148 self.destroy()
149 else:
150 # [Ok] moves focus. (<Return> does not.) Move it back.
151 self.entry.focus_set()
152
153 def cancel(self, event=None): # Do not replace.
154 "Set dialog result to None and destroy tk widget."

Callers 9

test_ok_blankMethod · 0.45
test_ok_goodMethod · 0.45
test_ok_emptyMethod · 0.45
test_ok_goodMethod · 0.45
test_init_modalMethod · 0.45
test_init_nonmodalMethod · 0.45
test_okMethod · 0.45
test_view_textMethod · 0.45
test_view_fileMethod · 0.45

Calls 3

entry_okMethod · 0.95
destroyMethod · 0.95
focus_setMethod · 0.45

Tested by 9

test_ok_blankMethod · 0.36
test_ok_goodMethod · 0.36
test_ok_emptyMethod · 0.36
test_ok_goodMethod · 0.36
test_init_modalMethod · 0.36
test_init_nonmodalMethod · 0.36
test_okMethod · 0.36
test_view_textMethod · 0.36
test_view_fileMethod · 0.36