[Pythonmac-SIG] How to call Apple Help from Python via Carbon.AH wrapper

Kevin Walzer sw at wordtech-software.com
Mon Jun 27 06:24:26 CEST 2005

Hash: SHA1

Hi everyone,

A few weeks ago I asked about how to call Apple Help from a Python
application because that functionality is provided via Carbon.
Apparently this API is so crufty that no one quite knew how. :-)

After some trial and error, I figured it out, and am actually using it
in several non-Python applications via "python -c" calls, for which
direct access to the Carbon Help API would be difficult or impossible.
(Aquamacs is one of them, my Tk applications are also examples.)

Here's a Pythonic sample of initalizing/registering the help book:

from Carbon import AH
path = /Applications/MyApp.app

And here's a sample of how to load a help book from the help menu:

from Carbon import AH
AH.AHGotoPage('MyApp Help', None, None)

The 'MyApp Help' is the Apple Title tag that you would add to the main
help page, as per the Apple documentation on user help.

You'd also, of course, need to correctly set up the proper elements in
the info.plist file (CFBundleHelpBookFolder--the directory within the
Resources folder in the app bundle--and CFBundleHelpBookName, which is
the Apple Title tag).

For me the appeal of this approach is that it's built-in to OS X via the
system Python installation; I don't have to ask anyone to install an
external framework (or bundle it myself).

Hope this is useful to somebody.

- --

Kevin Walzer, PhD
WordTech Software--Open Source Applications and Packages for OS X
mailto:sw at wordtech-software.com
Version: GnuPG v1.4.1 (Darwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org


More information about the Pythonmac-SIG mailing list