summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/CallTipWindow.py
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2014-10-17 05:31:35 (GMT)
committerTerry Jan Reedy <tjreedy@udel.edu>2014-10-17 05:31:35 (GMT)
commitcd567365c9f95cf005d6bb7c1da7946b68a43ab4 (patch)
treef26214676f8957a3e89451cc4cb54239bd5ab113 /Lib/idlelib/CallTipWindow.py
parent9a6f8e18662c67cd41bf54ef3b8dbf2b7f5a3aeb (diff)
downloadcpython-cd567365c9f95cf005d6bb7c1da7946b68a43ab4.zip
cpython-cd567365c9f95cf005d6bb7c1da7946b68a43ab4.tar.gz
cpython-cd567365c9f95cf005d6bb7c1da7946b68a43ab4.tar.bz2
Issue #22629: Revise idle_test.htest, mostly docstring. Start revision of
htests to add # htest # marker for coveragepy and stop tcl errors.
Diffstat (limited to 'Lib/idlelib/CallTipWindow.py')
-rw-r--r--Lib/idlelib/CallTipWindow.py52
1 files changed, 21 insertions, 31 deletions
diff --git a/Lib/idlelib/CallTipWindow.py b/Lib/idlelib/CallTipWindow.py
index 84d22fd..170d146 100644
--- a/Lib/idlelib/CallTipWindow.py
+++ b/Lib/idlelib/CallTipWindow.py
@@ -133,37 +133,27 @@ class CallTip:
def _calltip_window(parent): # htest #
- import re
- from tkinter import Tk, Text, LEFT, BOTH
-
- root = Tk()
- root.title("Test calltips")
- width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
- root.geometry("+%d+%d"%(x, y + 150))
-
- class MyEditWin: # conceptually an editor_window
- def __init__(self):
- text = self.text = Text(root)
- text.pack(side=LEFT, fill=BOTH, expand=1)
- text.insert("insert", "string.split")
- root.update()
- self.calltip = CallTip(text)
-
- text.event_add("<<calltip-show>>", "(")
- text.event_add("<<calltip-hide>>", ")")
- text.bind("<<calltip-show>>", self.calltip_show)
- text.bind("<<calltip-hide>>", self.calltip_hide)
-
- text.focus_set()
- root.mainloop()
-
- def calltip_show(self, event):
- self.calltip.showtip("Hello world", "insert", "end")
-
- def calltip_hide(self, event):
- self.calltip.hidetip()
-
- MyEditWin()
+ from tkinter import Toplevel, Text, LEFT, BOTH
+
+ top = Toplevel(parent)
+ top.title("Test calltips")
+ top.geometry("200x100+%d+%d" % (parent.winfo_rootx() + 200,
+ parent.winfo_rooty() + 150))
+ text = Text(top)
+ text.pack(side=LEFT, fill=BOTH, expand=1)
+ text.insert("insert", "string.split")
+ top.update()
+ calltip = CallTip(text)
+
+ def calltip_show(event):
+ calltip.showtip("(s=Hello world)", "insert", "end")
+ def calltip_hide(event):
+ calltip.hidetip()
+ text.event_add("<<calltip-show>>", "(")
+ text.event_add("<<calltip-hide>>", ")")
+ text.bind("<<calltip-show>>", calltip_show)
+ text.bind("<<calltip-hide>>", calltip_hide)
+ text.focus_set()
if __name__=='__main__':
from idlelib.idle_test.htest import run