mirror of https://github.com/python/cpython
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:
parent
a1d47f0e89
commit
43f1f68b7c
|
@ -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):
|
||||||
root.tk.call('console', 'hide')
|
try:
|
||||||
|
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):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue