From 4233340fa6925c9b30e7209fabe4c025df0376fa Mon Sep 17 00:00:00 2001 From: John Riggles Date: Sun, 16 Jun 2024 17:25:14 -0400 Subject: [PATCH 1/4] Update tooltip.py Fix an issue w/ Hovertip foreground color causing tooltip text not to render on Mac OS Add params for foreground and background to Hovertip.__init__() --- Lib/idlelib/tooltip.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Lib/idlelib/tooltip.py b/Lib/idlelib/tooltip.py index 3983690dd411771..ee33fb4078a3214 100644 --- a/Lib/idlelib/tooltip.py +++ b/Lib/idlelib/tooltip.py @@ -144,7 +144,7 @@ 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, foreground="#000000", background="#ffffe0", hover_delay=1000): """Create a text tooltip with a mouse hover delay. anchor_widget: the widget next to which the tooltip will be shown @@ -156,10 +156,12 @@ 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) + label = Label(self.tipwindow, text=self.text, justify=LEFT, foreground=self.foreground, + background=self.background, relief=SOLID, borderwidth=1) label.pack() From f76d9aa74d7cb4dfb6316ab655bac5c374b947cb Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Sun, 16 Jun 2024 21:42:45 +0000 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/IDLE/2024-06-16-21-42-45.gh-issue-120083.nczuyv.rst | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Misc/NEWS.d/next/IDLE/2024-06-16-21-42-45.gh-issue-120083.nczuyv.rst 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 000000000000000..bb6e9cc3d0058ab --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2024-06-16-21-42-45.gh-issue-120083.nczuyv.rst @@ -0,0 +1,5 @@ +This change does the following: +- Fixes an issue w/ Hovertip foreground color causing tooltip text not to render on Mac OS due to the foreground color being unspecified +- Adds params for 'foreground' and 'background' color to Hovertip.init() + +The default foreground color is '#000000' (black), and the default background color remains '#ffffe0' (pale yellow) From 304b801cbd3c9fd9145d4c18a0c85b99e15fd3f0 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Thu, 1 Aug 2024 15:40:56 -0400 Subject: [PATCH 3/4] Apply suggestions from code review --- Lib/idlelib/tooltip.py | 8 +++++--- .../IDLE/2024-06-16-21-42-45.gh-issue-120083.nczuyv.rst | 6 +----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Lib/idlelib/tooltip.py b/Lib/idlelib/tooltip.py index ee33fb4078a3214..df5b1fe1dcfb080 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, foreground="#000000", background="#ffffe0", 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 @@ -160,8 +161,9 @@ def __init__(self, anchor_widget, text, foreground="#000000", background="#ffffe self.background = background def showcontents(self): - label = Label(self.tipwindow, text=self.text, justify=LEFT, foreground=self.foreground, - background=self.background, relief=SOLID, borderwidth=1) + label = Label(self.tipwindow, text=self.text, justify=LEFT, + 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 index bb6e9cc3d0058ab..643c2bb38c6e1fe 100644 --- 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 @@ -1,5 +1 @@ -This change does the following: -- Fixes an issue w/ Hovertip foreground color causing tooltip text not to render on Mac OS due to the foreground color being unspecified -- Adds params for 'foreground' and 'background' color to Hovertip.init() - -The default foreground color is '#000000' (black), and the default background color remains '#ffffe0' (pale yellow) +Add explicit black IDLE Hovertip foreground color needed for recent macOS. Fixes Sonoma showing unreadable white on pale yellow. Patch by John Riggles. From 0ad63709469f93face930b732c5eb02aab35a9bb Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Thu, 1 Aug 2024 21:50:44 -0400 Subject: [PATCH 4/4] Add IDLE news item. --- Lib/idlelib/News3.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Lib/idlelib/News3.txt b/Lib/idlelib/News3.txt index a7a92e97b6c2444..37ff93f9866e3c5 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.