Skip to content
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
IDLE: Create function to update menu item state. (GH-11343)
This will be needed for other menu items.  Change outwin to call the function instead of updating the menu item directly.
(cherry picked from commit 804a5d9)

Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
  • Loading branch information
csabella authored and miss-islington committed Dec 28, 2018
commit 57608219519765d3328e7c4ad514f70f314341dd
7 changes: 6 additions & 1 deletion Lib/idlelib/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,10 +447,15 @@ def postwindowsmenu(self):
window.add_windows_to_menu(menu)

def update_menu_label(self, menu, index, label):
"Update label for menu item at index ."
"Update label for menu item at index."
menuitem = self.menudict[menu]
menuitem.entryconfig(index, label=label)

def update_menu_state(self, menu, index, state):
"Update state for menu item at index."
menuitem = self.menudict[menu]
menuitem.entryconfig(index, state=state)

def handle_yview(self, event, *args):
"Handle scrollbar."
if event == 'moveto':
Expand Down
3 changes: 1 addition & 2 deletions Lib/idlelib/outwin.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ def __init__(self, *args):
EditorWindow.__init__(self, *args)
self.text.bind("<<goto-file-line>>", self.goto_file_line)
self.text.unbind("<<toggle-code-context>>")
self.menudict['options'].entryconfig('*Code Context',
state='disabled')
self.update_menu_state('options', '*Code Context', 'disabled')

# Customize EditorWindow
def ispythonsource(self, filename):
Expand Down