https://github.com/python/cpython/commit/29733b084db99a76ef2ffe0664f7f1e0efa47679
commit: 29733b084db99a76ef2ffe0664f7f1e0efa47679
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: Yhg1s <[email protected]>
date: 2024-09-02T12:50:39+02:00
summary:

[3.13] gh-120083: Add IDLE Hovertip foreground color needed for recent macOS 
(GH-120605) (#122739)

gh-120083: Add IDLE Hovertip foreground color needed for recent macOS 
(GH-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 (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 5a7f7c48644baf82988f30bcb43e03dcfceb75dd)

Co-authored-by: John Riggles <[email protected]>
Co-authored-by: Terry Jan Reedy <[email protected]>

files:
A Misc/NEWS.d/next/IDLE/2024-06-16-21-42-45.gh-issue-120083.nczuyv.rst
M Lib/idlelib/News3.txt
M Lib/idlelib/tooltip.py

diff --git a/Lib/idlelib/News3.txt b/Lib/idlelib/News3.txt
index a7a92e97b6c244..37ff93f9866e3c 100644
--- a/Lib/idlelib/News3.txt
+++ b/Lib/idlelib/News3.txt
@@ -4,6 +4,10 @@ Released on 2024-10-xx
 =========================
 
 
+gh-120083: Add explicit black IDLE Hovertip foreground color needed for
+recent macOS. Fixes Sonoma showing unreadable white on pale yellow.
+Patch by John Riggles.
+
 gh-122482: Change About IDLE to direct users to discuss.python.org
 instead of the now unused idle-dev email and mailing list.
 
diff --git a/Lib/idlelib/tooltip.py b/Lib/idlelib/tooltip.py
index 3983690dd41177..df5b1fe1dcfb08 100644
--- a/Lib/idlelib/tooltip.py
+++ b/Lib/idlelib/tooltip.py
@@ -144,7 +144,8 @@ def hidetip(self):
 
 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):
+    def __init__(self, anchor_widget, text, hover_delay=1000,
+                 foreground="#000000", background="#ffffe0"):
         """Create a text tooltip with a mouse hover delay.
 
         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):
         """
         super().__init__(anchor_widget, hover_delay=hover_delay)
         self.text = text
+        self.foreground = foreground
+        self.background = background
 
     def showcontents(self):
         label = Label(self.tipwindow, text=self.text, justify=LEFT,
-                      background="#ffffe0", relief=SOLID, borderwidth=1)
+                       relief=SOLID,  borderwidth=1,
+                       foreground=self.foreground, background=self.background)
         label.pack()
 
 
diff --git 
a/Misc/NEWS.d/next/IDLE/2024-06-16-21-42-45.gh-issue-120083.nczuyv.rst 
b/Misc/NEWS.d/next/IDLE/2024-06-16-21-42-45.gh-issue-120083.nczuyv.rst
new file mode 100644
index 00000000000000..643c2bb38c6e1f
--- /dev/null
+++ b/Misc/NEWS.d/next/IDLE/2024-06-16-21-42-45.gh-issue-120083.nczuyv.rst
@@ -0,0 +1 @@
+Add explicit black IDLE Hovertip foreground color needed for recent macOS.  
Fixes Sonoma showing unreadable white on pale yellow.  Patch by John Riggles.

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to