Fixes IDLE crash on OSX: some versions of Tcl/Tk on OSX don't have a

console object, avoid crashing in that case.
This commit is contained in:
Ronald Oussoren 2007-07-09 05:46:04 +00:00
parent a1d47f0e89
commit 43f1f68b7c
1 changed files with 6 additions and 1 deletions

View File

@ -3,6 +3,7 @@ A number of function that enhance IDLE on MacOSX when it used as a normal
GUI application (as opposed to an X11 application). GUI application (as opposed to an X11 application).
""" """
import sys import sys
import Tkinter
def runningAsOSXApp(): def runningAsOSXApp():
""" Returns True iff running from the IDLE.app bundle on OSX """ """ Returns True iff running from the IDLE.app bundle on OSX """
@ -23,7 +24,11 @@ def addOpenEventSupport(root, flist):
root.createcommand("::tk::mac::OpenDocument", doOpenFile) root.createcommand("::tk::mac::OpenDocument", doOpenFile)
def hideTkConsole(root): def hideTkConsole(root):
try:
root.tk.call('console', 'hide') root.tk.call('console', 'hide')
except Tkinter.TclError:
# Some versions of the Tk framework don't have a console object
pass
def overrideRootMenu(root, flist): def overrideRootMenu(root, flist):
""" """