Issue #27620: Escape key closes Query box as cancelled.

This commit is contained in:
Terry Jan Reedy 2016-07-25 20:58:43 -04:00
parent 8e1d3a2d41
commit 17937832ba
2 changed files with 4 additions and 3 deletions

View file

@ -175,8 +175,8 @@ HelpSource_spec = {
"'' and file does not exist are invalid path items.\n" "'' and file does not exist are invalid path items.\n"
"Any url ('www...', 'http...') is accepted.\n" "Any url ('www...', 'http...') is accepted.\n"
"Test Browse with and without path, as cannot unittest.\n" "Test Browse with and without path, as cannot unittest.\n"
"A valid entry will be printed to shell with [0k]\n" "[Ok] or <Return> prints valid entry to shell\n"
"or <return>. [Cancel] will print None to shell" "[Cancel] or <Escape> prints None to shell"
} }
_io_binding_spec = { _io_binding_spec = {
@ -245,7 +245,7 @@ Query_spec = {
'_htest': True}, '_htest': True},
'msg': "Enter with <Return> or [Ok]. Print valid entry to Shell\n" 'msg': "Enter with <Return> or [Ok]. Print valid entry to Shell\n"
"Blank line, after stripping, is ignored\n" "Blank line, after stripping, is ignored\n"
"Close dialog with valid entry, [Cancel] or [X]" "Close dialog with valid entry, <Escape>, [Cancel], [X]"
} }

View file

@ -53,6 +53,7 @@ class Query(Toplevel):
self.transient(parent) self.transient(parent)
self.grab_set() self.grab_set()
self.bind('<Key-Return>', self.ok) self.bind('<Key-Return>', self.ok)
self.bind('<Key-Escape>', self.cancel)
self.protocol("WM_DELETE_WINDOW", self.cancel) self.protocol("WM_DELETE_WINDOW", self.cancel)
self.parent = parent self.parent = parent
self.message = message self.message = message