summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/CallTipWindow.py
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2014-05-24 22:48:18 (GMT)
committerTerry Jan Reedy <tjreedy@udel.edu>2014-05-24 22:48:18 (GMT)
commit1b392ffe67febbe8740520289bb828fdf060e363 (patch)
tree27d5496ec5479afd9d1a36efcd02614315e7c447 /Lib/idlelib/CallTipWindow.py
parent10cbb1e463378391d2368874bb31af0447fa73e6 (diff)
downloadcpython-1b392ffe67febbe8740520289bb828fdf060e363.zip
cpython-1b392ffe67febbe8740520289bb828fdf060e363.tar.gz
cpython-1b392ffe67febbe8740520289bb828fdf060e363.tar.bz2
Issue #21477: Idle htest: merge and modify run and runall; add many tests.
Patch by Saimadhav Heblikar
Diffstat (limited to 'Lib/idlelib/CallTipWindow.py')
-rw-r--r--Lib/idlelib/CallTipWindow.py61
1 files changed, 30 insertions, 31 deletions
diff --git a/Lib/idlelib/CallTipWindow.py b/Lib/idlelib/CallTipWindow.py
index 8e29dab..aacfa00 100644
--- a/Lib/idlelib/CallTipWindow.py
+++ b/Lib/idlelib/CallTipWindow.py
@@ -133,37 +133,36 @@ class CallTip:
return bool(self.tipwindow)
+def _calltip_window(parent):
+ 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))
-###############################
-#
-# Test Code
-#
-class container: # Conceptually an editor_window
- def __init__(self):
- root = Tk()
- 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")
-
- def calltip_hide(self, event):
- self.calltip.hidetip()
-
-def main():
- # Test code
- c=container()
+ class MyEditWin: # comparenceptually 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()
+
+ editwin = MyEditWin()
if __name__=='__main__':
- main()
+ from idlelib.idle_test.htest import run
+ run(_calltip_window)