Skip to content

Commit a0f1f12

Browse files
miss-islingtonXiaokang2022ZeroIntensityterryjreedy
authored
[3.13] gh-128062: Fix the font size and shortcut display of the turtledemo menu (GH-128063) (#128101)
gh-128062: Fix the font size and shortcut display of the turtledemo menu (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 <[email protected]> Co-authored-by: Peter Bierma <[email protected]> Co-authored-by: Terry Jan Reedy <[email protected]>
1 parent 08f9b7c commit a0f1f12

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

Lib/turtledemo/__main__.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@
107107
DONE = 4
108108
EVENTDRIVEN = 5
109109

110-
menufont = ("Arial", 12, NORMAL)
111110
btnfont = ("Arial", 12, 'bold')
112111
txtfont = ['Lucida Console', 10, 'normal']
113112

@@ -299,23 +298,21 @@ def makeLoadDemoMenu(self, master):
299298
for entry in getExampleEntries():
300299
def load(entry=entry):
301300
self.loadfile(entry)
302-
menu.add_command(label=entry, underline=0,
303-
font=menufont, command=load)
301+
menu.add_command(label=entry, underline=0, command=load)
304302
return menu
305303

306304
def makeFontMenu(self, master):
307305
menu = Menu(master, tearoff=0)
308-
menu.add_command(label="Decrease (C-'-')", command=self.decrease_size,
309-
font=menufont)
310-
menu.add_command(label="Increase (C-'+')", command=self.increase_size,
311-
font=menufont)
306+
menu.add_command(label="Decrease", command=self.decrease_size,
307+
accelerator=f"{'Command' if darwin else 'Ctrl'}+-")
308+
menu.add_command(label="Increase", command=self.increase_size,
309+
accelerator=f"{'Command' if darwin else 'Ctrl'}+=")
312310
menu.add_separator()
313311

314312
for size in font_sizes:
315313
def resize(size=size):
316314
self.set_txtsize(size)
317-
menu.add_command(label=str(size), underline=0,
318-
font=menufont, command=resize)
315+
menu.add_command(label=str(size), underline=0, command=resize)
319316
return menu
320317

321318
def makeHelpMenu(self, master):
@@ -324,7 +321,7 @@ def makeHelpMenu(self, master):
324321
for help_label, help_file in help_entries:
325322
def show(help_label=help_label, help_file=help_file):
326323
view_text(self.root, help_label, help_file)
327-
menu.add_command(label=help_label, font=menufont, command=show)
324+
menu.add_command(label=help_label, command=show)
328325
return menu
329326

330327
def refreshCanvas(self):
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Revert the font of :mod:`turtledemo`'s menu bar to its default value and
2+
display the shortcut keys in the correct position.

0 commit comments

Comments
 (0)