Skip to content

Commit 1f779b0

Browse files
miss-islingtonJRigglesterryjreedy
authored
[3.12] gh-120083: Add IDLE Hovertip foreground color needed for recent macOS (GH-120605) (#122592)
On recent versions of macOS (sometime between Catalina and Sonoma 14.5), the default Hovertip foreground color changed from black to white, thereby matching the background. This might be a matter of matching the white foreground of the dark-mode text. The unreadable result is shown here (GH-120083 (comment)). The foreground and background colors were made parameters so we can pass different colors for future additional hovertips in IDLE. --------- (cherry picked from commit 5a7f7c4) Co-authored-by: John Riggles <[email protected]> Co-authored-by: Terry Jan Reedy <[email protected]>
1 parent 22fdeeb commit 1f779b0

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

Lib/idlelib/News3.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ Released after 2023-10-02
44
=========================
55

66

7+
gh-120083: Add explicit black IDLE Hovertip foreground color needed for
8+
recent macOS. Fixes Sonoma showing unreadable white on pale yellow.
9+
Patch by John Riggles.
10+
711
gh-122482: Change About IDLE to direct users to discuss.python.org
812
instead of the now unused idle-dev email and mailing list.
913

Lib/idlelib/tooltip.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ def hidetip(self):
144144

145145
class Hovertip(OnHoverTooltipBase):
146146
"A tooltip that pops up when a mouse hovers over an anchor widget."
147-
def __init__(self, anchor_widget, text, hover_delay=1000):
147+
def __init__(self, anchor_widget, text, hover_delay=1000,
148+
foreground="#000000", background="#ffffe0"):
148149
"""Create a text tooltip with a mouse hover delay.
149150
150151
anchor_widget: the widget next to which the tooltip will be shown
@@ -156,10 +157,13 @@ def __init__(self, anchor_widget, text, hover_delay=1000):
156157
"""
157158
super().__init__(anchor_widget, hover_delay=hover_delay)
158159
self.text = text
160+
self.foreground = foreground
161+
self.background = background
159162

160163
def showcontents(self):
161164
label = Label(self.tipwindow, text=self.text, justify=LEFT,
162-
background="#ffffe0", relief=SOLID, borderwidth=1)
165+
relief=SOLID, borderwidth=1,
166+
foreground=self.foreground, background=self.background)
163167
label.pack()
164168

165169

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add explicit black IDLE Hovertip foreground color needed for recent macOS. Fixes Sonoma showing unreadable white on pale yellow. Patch by John Riggles.

0 commit comments

Comments
 (0)