menutest.py 442 B

123456789101112
  1. # Run this as a python script, to gray "close" off the edit window system menu.
  2. from pywin.framework import interact
  3. import win32con
  4. if __name__=='__main__':
  5. import demoutils
  6. if demoutils.NeedGoodGUI():
  7. win=interact.edit.currentView.GetParent()
  8. menu=win.GetSystemMenu()
  9. id=menu.GetMenuItemID(6)
  10. menu.EnableMenuItem(id,win32con.MF_BYCOMMAND|win32con.MF_GRAYED)
  11. print("The interactive window's 'Close' menu item is now disabled.")