Closed
Description
Bug report
Bug description:
Minimal Reproducible Example
import tkinter as tk
from idlelib.tooltip import Hovertip
root = tk.Tk()
root.geometry('200x100')
label = tk.Label(root, text='Hover Me!')
label.pack()
tip = Hovertip(label, text='Pro Tip')
root.mainloop()
Proposed Fix
Specifying a foreground color, e.g. foreground="black"
, at the Label
declaration in Hovertip.showcontents()
fixes the issue
class Hovertip(OnHoverTooltipBase):
"A tooltip that pops up when a mouse hovers over an anchor widget."
def __init__(self, anchor_widget, text, hover_delay=1000):
"""Create a text tooltip with a mouse hover delay.
anchor_widget: the widget next to which the tooltip will be shown
hover_delay: time to delay before showing the tooltip, in milliseconds
Note that a widget will only be shown when showtip() is called,
e.g. after hovering over the anchor widget with the mouse for enough
time.
"""
super().__init__(anchor_widget, hover_delay=hover_delay)
self.text = text
def showcontents(self):
label = Label(self.tipwindow, text=self.text, justify=LEFT,
foreground="black", background="#ffffe0", relief=SOLID, borderwidth=1)
label.pack()
CPython versions tested on:
3.12
Operating systems tested on:
macOS
Linked PRs
Metadata
Metadata
Assignees
Projects
Status
Done