def runningAsOSXApp():
 global _appbundle
 if (_appbundle is None):
  _appbundle = ((sys.platform == 'darwin') and ('.app' in sys.executable))
 return _appbundle

def runningAsOSXApp ( ) : global _appbundle if ( _appbundle is None ) : _appbundle = ( ( sys . platform == 'darwin' ) and ( '.app' in sys . executable ) ) return _appbundle
returns true if python is running from within an app on osx .