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

Class Hovertip

Lib/idlelib/tooltip.py:145–167  ·  view source on GitHub ↗

A tooltip that pops up when a mouse hovers over an anchor widget.

Source from the content-addressed store, hash-verified

143
144
145class Hovertip(OnHoverTooltipBase):
146 "A tooltip that pops up when a mouse hovers over an anchor widget."
147 def __init__(self, anchor_widget, text, hover_delay=1000,
148 foreground="#000000", background="#ffffe0"):
149 """Create a text tooltip with a mouse hover delay.
150
151 anchor_widget: the widget next to which the tooltip will be shown
152 hover_delay: time to delay before showing the tooltip, in milliseconds
153
154 Note that a widget will only be shown when showtip() is called,
155 e.g. after hovering over the anchor widget with the mouse for enough
156 time.
157 """
158 super().__init__(anchor_widget, hover_delay=hover_delay)
159 self.text = text
160 self.foreground = foreground
161 self.background = background
162
163 def showcontents(self):
164 label = Label(self.tipwindow, text=self.text, justify=LEFT,
165 relief=SOLID, borderwidth=1,
166 foreground=self.foreground, background=self.background)
167 label.pack()
168
169
170def _tooltip(parent): # htest #

Callers 8

__init__Method · 0.90
test_showtipMethod · 0.90
test_showtip_twiceMethod · 0.90
test_hidetipMethod · 0.90
test_hover_with_delayMethod · 0.90
_tooltipFunction · 0.85

Calls

no outgoing calls

Tested by 6

test_showtipMethod · 0.72
test_showtip_twiceMethod · 0.72
test_hidetipMethod · 0.72
test_hover_with_delayMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…