Jack Jansen | 6ad8d13 | 1997-01-15 16:53:37 +0000 | [diff] [blame] | 1 | <HTML> |
| 2 | <HEAD> |
| 3 | <TITLE>Embedding Python on the Mac</TITLE> |
| 4 | </HEAD> |
| 5 | <BODY> |
| 6 | <H1>Embedding Python on the Mac</H1> |
| 7 | <HR> |
| 8 | |
| 9 | Embedding Python on the mac is pretty similar to embedding it on other |
| 10 | platforms, but a few points need mentioning: |
| 11 | |
| 12 | <UL> |
| 13 | <LI> You call <CODE>PyMac_Initialize()</CODE> in stead of |
| 14 | <CODE>Py_Initialize()</CODE>. The prototype is in <CODE>macglue.h</CODE>. |
| 15 | This call initializes the toolbox, GUSI (if needed), sets up the correct |
| 16 | resource files and calls Py_Initialize. |
| 17 | |
| 18 | <LI> You have to be consequent in your use of GUSI. If the library uses |
| 19 | it so should your program and vice versa. |
| 20 | |
| 21 | <LI> The console-behaviour (close-on-exit, etc) is controlled by Python, |
| 22 | but you are of course free to change that after calling PyMac_Initialize(). |
| 23 | </UL> |
| 24 | |
| 25 | The Python environment is started with a dummy argc and argv, and initial |
| 26 | startup options are obtained through the usual means, except that the |
| 27 | user pression the option-key will not result in an interactive dialog. |
| 28 | You can, however, set startup options on your program in the same way as you |
| 29 | do for applets, by dragging your application to <code>EditPythonPrefs</code>. <p> |
| 30 | |
Jack Jansen | 3412c5d | 1997-08-27 14:08:22 +0000 | [diff] [blame^] | 31 | The most logical way to embed Python is to link it against the shared |
| 32 | library <code>PythonCore</code>. An example project and source can be |
| 33 | found in the <a href="embed">embed</a> folder. |
Jack Jansen | 6ad8d13 | 1997-01-15 16:53:37 +0000 | [diff] [blame] | 34 | |
| 35 | </BODY> |
| 36 | </HTML> |