Skip to content

Commit 804a5d9

Browse files
csabellaterryjreedy
authored andcommitted
IDLE: Create function to update menu item state. (pythonGH-11343)
This will be needed for other menu items. Change outwin to call the function instead of updating the menu item directly.
1 parent 9e00d9e commit 804a5d9

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Lib/idlelib/editor.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -447,10 +447,15 @@ def postwindowsmenu(self):
447447
window.add_windows_to_menu(menu)
448448

449449
def update_menu_label(self, menu, index, label):
450-
"Update label for menu item at index ."
450+
"Update label for menu item at index."
451451
menuitem = self.menudict[menu]
452452
menuitem.entryconfig(index, label=label)
453453

454+
def update_menu_state(self, menu, index, state):
455+
"Update state for menu item at index."
456+
menuitem = self.menudict[menu]
457+
menuitem.entryconfig(index, state=state)
458+
454459
def handle_yview(self, event, *args):
455460
"Handle scrollbar."
456461
if event == 'moveto':

Lib/idlelib/outwin.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ def __init__(self, *args):
7878
EditorWindow.__init__(self, *args)
7979
self.text.bind("<<goto-file-line>>", self.goto_file_line)
8080
self.text.unbind("<<toggle-code-context>>")
81-
self.menudict['options'].entryconfig('*Code Context',
82-
state='disabled')
81+
self.update_menu_state('options', '*Code Context', 'disabled')
8382

8483
# Customize EditorWindow
8584
def ispythonsource(self, filename):

0 commit comments

Comments
 (0)