Fix for issue5194, based on a patch by Ned Deily.
diff --git a/Lib/idlelib/Bindings.py b/Lib/idlelib/Bindings.py
index 13e2a33..74a93d3 100644
--- a/Lib/idlelib/Bindings.py
+++ b/Lib/idlelib/Bindings.py
@@ -10,6 +10,7 @@
 """
 import sys
 from idlelib.configHandler import idleConf
+from idlelib import macosxSupport
 
 menudefs = [
  # underscore prefixes character to underscore
@@ -80,7 +81,7 @@
    ]),
 ]
 
-if sys.platform == 'darwin' and '.app' in sys.executable:
+if macosxSupport.runningAsOSXApp():
     # Running as a proper MacOS application bundle. This block restructures
     # the menus a little to make them conform better to the HIG.
 
diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py
index 1512c46..38ae7b6 100644
--- a/Lib/idlelib/EditorWindow.py
+++ b/Lib/idlelib/EditorWindow.py
@@ -363,7 +363,7 @@
             underline, label = prepstr(label)
             menudict[name] = menu = Menu(mbar, name=name)
             mbar.add_cascade(label=label, menu=menu, underline=underline)
-        if sys.platform == 'darwin' and '.framework' in sys.executable:
+        if macosxSupport.runningAsOSXApp():
             # Insert the application menu
             menudict['application'] = menu = Menu(mbar, name='apple')
             mbar.add_cascade(label='IDLE', menu=menu)
diff --git a/Lib/idlelib/MultiCall.py b/Lib/idlelib/MultiCall.py
index 1c40638..47f402d 100644
--- a/Lib/idlelib/MultiCall.py
+++ b/Lib/idlelib/MultiCall.py
@@ -32,6 +32,7 @@
 import sys
 import re
 import tkinter
+from idlelib import macosxSupport
 
 # the event type constants, which define the meaning of mc_type
 MC_KEYPRESS=0; MC_KEYRELEASE=1; MC_BUTTONPRESS=2; MC_BUTTONRELEASE=3;
@@ -44,7 +45,7 @@
 MC_OPTION = 1<<6; MC_COMMAND = 1<<7
 
 # define the list of modifiers, to be used in complex event types.
-if sys.platform == "darwin" and sys.executable.count(".app"):
+if macosxSupport.runningAsOSXApp():
     _modifiers = (("Shift",), ("Control",), ("Option",), ("Command",))
     _modifier_masks = (MC_SHIFT, MC_CONTROL, MC_OPTION, MC_COMMAND)
 else:
diff --git a/Lib/idlelib/keybindingDialog.py b/Lib/idlelib/keybindingDialog.py
index f5d32ef..b99c5e0 100644
--- a/Lib/idlelib/keybindingDialog.py
+++ b/Lib/idlelib/keybindingDialog.py
@@ -4,6 +4,7 @@
 from tkinter import *
 import tkinter.messagebox as tkMessageBox
 import string
+from idlelib import macosxSupport
 
 class GetKeysDialog(Toplevel):
     def __init__(self,parent,title,action,currentKeySequences):
@@ -133,7 +134,7 @@
         config-keys.def must use the same ordering.
         """
         import sys
-        if sys.platform == 'darwin' and sys.argv[0].count('.app'):
+        if macosxSupport.runningAsOSXApp():
             self.modifiers = ['Shift', 'Control', 'Option', 'Command']
         else:
             self.modifiers = ['Control', 'Alt', 'Shift']
diff --git a/Lib/idlelib/macosxSupport.py b/Lib/idlelib/macosxSupport.py
index 9f92b6c..e759157 100644
--- a/Lib/idlelib/macosxSupport.py
+++ b/Lib/idlelib/macosxSupport.py
@@ -6,8 +6,12 @@
 import tkinter
 
 def runningAsOSXApp():
-    """ Returns True iff running from the IDLE.app bundle on OSX """
-    return (sys.platform == 'darwin' and 'IDLE.app' in sys.argv[0])
+    """
+    Returns True if Python is running from within an app on OSX.
+    If so, assume that Python was built with Aqua Tcl/Tk rather than
+    X11 Tck/Tk.
+    """
+    return (sys.platform == 'darwin' and '.app' in sys.executable)
 
 def addOpenEventSupport(root, flist):
     """