diff options
author | Zhikang Yan <2951256653@qq.com> | 2024-12-19 20:24:47 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-19 20:24:47 (GMT) |
commit | e163e8d4e1a9844b8615ef38b9917b887a377948 (patch) | |
tree | bd3f44ba60e26ec4df6217e7ff9902637adf871e /Lib | |
parent | 1b15c89a17ca3de6b05de5379b8717e9738c51ef (diff) | |
download | cpython-e163e8d4e1a9844b8615ef38b9917b887a377948.zip cpython-e163e8d4e1a9844b8615ef38b9917b887a377948.tar.gz cpython-e163e8d4e1a9844b8615ef38b9917b887a377948.tar.bz2 |
gh-128062: Fix the font size and shortcut display of the turtledemo menu (#128063)
Leave the font of the menu bar the default to keep it consistent with the rest of the world. Display the shortcut keys in the right way, using the 'accelerator' option.
---------
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/turtledemo/__main__.py | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/Lib/turtledemo/__main__.py b/Lib/turtledemo/__main__.py index 9c15916..b49c0be 100644 --- a/Lib/turtledemo/__main__.py +++ b/Lib/turtledemo/__main__.py @@ -105,7 +105,6 @@ RUNNING = 3 DONE = 4 EVENTDRIVEN = 5 -menufont = ("Arial", 12, NORMAL) btnfont = ("Arial", 12, 'bold') txtfont = ['Lucida Console', 10, 'normal'] @@ -297,23 +296,21 @@ class DemoWindow(object): 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 @@ class DemoWindow(object): 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): |