mirror of
https://github.com/python/cpython.git
synced 2025-07-08 03:45:36 +00:00
bpo-27115: Use Query subclass for IDLE editor Goto (GH-18871)
Replace tkinter tkSimpleDialog.askinteger with a standard IDLE query dialog. The new box checks for positivity before returning.
This commit is contained in:
parent
e7cab7f780
commit
363fab83b8
5 changed files with 74 additions and 12 deletions
|
@ -672,18 +672,16 @@ class EditorWindow(object):
|
|||
|
||||
def goto_line_event(self, event):
|
||||
text = self.text
|
||||
lineno = tkSimpleDialog.askinteger("Goto",
|
||||
"Go to line number:",parent=text)
|
||||
if lineno is None:
|
||||
return "break"
|
||||
if lineno <= 0:
|
||||
text.bell()
|
||||
return "break"
|
||||
|
||||
text.tag_remove("sel", "1.0", "end")
|
||||
text.mark_set("insert", f'{lineno}.0')
|
||||
text.see("insert")
|
||||
self.set_line_and_column()
|
||||
lineno = query.Goto(
|
||||
text, "Go To Line",
|
||||
"Enter a positive integer\n"
|
||||
"('big' = end of file):"
|
||||
).result
|
||||
if lineno is not None:
|
||||
text.tag_remove("sel", "1.0", "end")
|
||||
text.mark_set("insert", f'{lineno}.0')
|
||||
text.see("insert")
|
||||
self.set_line_and_column()
|
||||
return "break"
|
||||
|
||||
def open_module(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue