From 621b1425514a8e0cc8c5f36949548516dbbe3e4e Mon Sep 17 00:00:00 2001 From: Xiaokang2022 <2951256653@qq.com> Date: Wed, 18 Dec 2024 17:57:27 +0800 Subject: [PATCH 1/4] fix: Fix the bug that the font size of the menu bar in `turtledemo` is too large and the shortcut key is displayed inaccurately --- Lib/turtledemo/__main__.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/Lib/turtledemo/__main__.py b/Lib/turtledemo/__main__.py index 9c15916fb6672e..b49c0beab3ccf7 100644 --- a/Lib/turtledemo/__main__.py +++ b/Lib/turtledemo/__main__.py @@ -105,7 +105,6 @@ DONE = 4 EVENTDRIVEN = 5 -menufont = ("Arial", 12, NORMAL) btnfont = ("Arial", 12, 'bold') txtfont = ['Lucida Console', 10, 'normal'] @@ -297,23 +296,21 @@ def makeLoadDemoMenu(self, master): for entry in getExampleEntries(): def load(entry=entry): self.loadfile(entry) - menu.add_command(label=entry, underline=0, - font=menufont, command=load) + menu.add_command(label=entry, underline=0, command=load) return menu def makeFontMenu(self, master): menu = Menu(master, tearoff=0) - menu.add_command(label="Decrease (C-'-')", command=self.decrease_size, - font=menufont) - menu.add_command(label="Increase (C-'+')", command=self.increase_size, - font=menufont) + menu.add_command(label="Decrease", command=self.decrease_size, + accelerator=f"{'Command' if darwin else 'Ctrl'}+-") + menu.add_command(label="Increase", command=self.increase_size, + accelerator=f"{'Command' if darwin else 'Ctrl'}+=") menu.add_separator() for size in font_sizes: def resize(size=size): self.set_txtsize(size) - menu.add_command(label=str(size), underline=0, - font=menufont, command=resize) + menu.add_command(label=str(size), underline=0, command=resize) return menu def makeHelpMenu(self, master): @@ -322,7 +319,7 @@ def makeHelpMenu(self, master): for help_label, help_file in help_entries: def show(help_label=help_label, help_file=help_file): view_text(self.root, help_label, help_file) - menu.add_command(label=help_label, font=menufont, command=show) + menu.add_command(label=help_label, command=show) return menu def refreshCanvas(self): From 71047b71e795b575b195c4da07e53c0e20e22cc5 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Wed, 18 Dec 2024 10:18:57 +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/Library/2024-12-18-10-18-55.gh-issue-128062.E9oU7-.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2024-12-18-10-18-55.gh-issue-128062.E9oU7-.rst diff --git a/Misc/NEWS.d/next/Library/2024-12-18-10-18-55.gh-issue-128062.E9oU7-.rst b/Misc/NEWS.d/next/Library/2024-12-18-10-18-55.gh-issue-128062.E9oU7-.rst new file mode 100644 index 00000000000000..02ac7c523e74ce --- /dev/null +++ b/Misc/NEWS.d/next/Library/2024-12-18-10-18-55.gh-issue-128062.E9oU7-.rst @@ -0,0 +1 @@ +Improve the menu bar of ``turtledemo``. From 2145d336f6bcf0a153a9e5e0fd501b4c917b24eb Mon Sep 17 00:00:00 2001 From: Zhikang Yan <2951256653@qq.com> Date: Wed, 18 Dec 2024 22:30:32 +0800 Subject: [PATCH 3/4] Update Misc/NEWS.d/next/Library/2024-12-18-10-18-55.gh-issue-128062.E9oU7-.rst Co-authored-by: Peter Bierma --- .../next/Library/2024-12-18-10-18-55.gh-issue-128062.E9oU7-.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2024-12-18-10-18-55.gh-issue-128062.E9oU7-.rst b/Misc/NEWS.d/next/Library/2024-12-18-10-18-55.gh-issue-128062.E9oU7-.rst index 02ac7c523e74ce..ed9af1792996be 100644 --- a/Misc/NEWS.d/next/Library/2024-12-18-10-18-55.gh-issue-128062.E9oU7-.rst +++ b/Misc/NEWS.d/next/Library/2024-12-18-10-18-55.gh-issue-128062.E9oU7-.rst @@ -1 +1 @@ -Improve the menu bar of ``turtledemo``. +Improve the menu bar of :mod:`turtledemo`. From 79a11f8b79a9be810a56a6bd5f3832167cd23d67 Mon Sep 17 00:00:00 2001 From: Xiaokang2022 <2951256653@qq.com> Date: Wed, 18 Dec 2024 22:38:00 +0800 Subject: [PATCH 4/4] docs: improve the blurb entry --- .../Library/2024-12-18-10-18-55.gh-issue-128062.E9oU7-.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2024-12-18-10-18-55.gh-issue-128062.E9oU7-.rst b/Misc/NEWS.d/next/Library/2024-12-18-10-18-55.gh-issue-128062.E9oU7-.rst index ed9af1792996be..d8e262e0848077 100644 --- a/Misc/NEWS.d/next/Library/2024-12-18-10-18-55.gh-issue-128062.E9oU7-.rst +++ b/Misc/NEWS.d/next/Library/2024-12-18-10-18-55.gh-issue-128062.E9oU7-.rst @@ -1 +1,2 @@ -Improve the menu bar of :mod:`turtledemo`. +Revert the font of :mod:`turtledemo`'s menu bar to its default value and +display the shortcut keys in the correct position.