Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5a7f7c4

Browse filesBrowse files
gh-120083: Add IDLE Hovertip foreground color needed for recent macOS (#120605)
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 (#120083 (comment)). The foreground and background colors were made parameters so we can pass different colors for future additional hovertips in IDLE. --------- Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
1 parent dbdbef3 commit 5a7f7c4
Copy full SHA for 5a7f7c4

File tree

3 files changed

+11
-2
lines changed
Filter options

3 files changed

+11
-2
lines changed

‎Lib/idlelib/News3.txt

Copy file name to clipboardExpand all lines: Lib/idlelib/News3.txt
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ Released on 2024-10-xx
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

Copy file name to clipboardExpand all lines: Lib/idlelib/tooltip.py
+6-2Lines 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

+1Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.