8000 [3.13] gh-128062: Fix the font size and shortcut display of the turtledemo menu (GH-128063) by miss-islington · Pull Request #128101 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

[3.13] gh-128062: Fix the font size and shortcut display of the turtledemo menu (GH-128063) #128101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gh-128062: Fix the font size and shortcut display of the turtledemo m…
…enu (GH-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.
---------

(cherry picked from commit e163e8d)

Co-authored-by: Zhikang Yan <2951256653@qq.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
  • Loading branch information
3 people authored and miss-islington committed Dec 19, 2024
commit b9b724297b52d01890462b22f571cd988018ab43
17 changes: 7 additions & 10 deletions Lib/turtledemo/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@
DONE = 4
EVENTDRIVEN = 5

menufont = ("Arial", 12, NORMAL)
btnfont = ("Arial", 12, 'bold')
txtfont = ['Lucida Console', 10, 'normal']

Expand Down Expand Up @@ -299,23 +298,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):
Expand All @@ -324,7 +321,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):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Revert the font of :mod:`turtledemo`'s menu bar to its default value and
display the shortcut keys in the correct position.
Loading
0