mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	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.
This commit is contained in:
		
							parent
							
								
									9e00d9e88f
								
							
						
					
					
						commit
						804a5d94b6
					
				
					 2 changed files with 7 additions and 3 deletions
				
			
		|  | @ -447,10 +447,15 @@ def postwindowsmenu(self): | ||||||
|         window.add_windows_to_menu(menu) |         window.add_windows_to_menu(menu) | ||||||
| 
 | 
 | ||||||
|     def update_menu_label(self, menu, index, label): |     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 = self.menudict[menu] | ||||||
|         menuitem.entryconfig(index, label=label) |         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): |     def handle_yview(self, event, *args): | ||||||
|         "Handle scrollbar." |         "Handle scrollbar." | ||||||
|         if event == 'moveto': |         if event == 'moveto': | ||||||
|  |  | ||||||
|  | @ -78,8 +78,7 @@ def __init__(self, *args): | ||||||
|         EditorWindow.__init__(self, *args) |         EditorWindow.__init__(self, *args) | ||||||
|         self.text.bind("<<goto-file-line>>", self.goto_file_line) |         self.text.bind("<<goto-file-line>>", self.goto_file_line) | ||||||
|         self.text.unbind("<<toggle-code-context>>") |         self.text.unbind("<<toggle-code-context>>") | ||||||
|         self.menudict['options'].entryconfig('*Code Context', |         self.update_menu_state('options', '*Code Context', 'disabled') | ||||||
|                                              state='disabled') |  | ||||||
| 
 | 
 | ||||||
|     # Customize EditorWindow |     # Customize EditorWindow | ||||||
|     def ispythonsource(self, filename): |     def ispythonsource(self, filename): | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Cheryl Sabella
						Cheryl Sabella