Jack Jansen | a630813 | 1996-03-18 13:38:52 +0000 | [diff] [blame] | 1 | <HTML><HEAD><TITLE>Macintosh Python crash course</TITLE></HEAD> |
| 2 | <BODY> |
| 3 | <H1><IMG SRC="html.icons/python.gif">Macintosh Python crash course</H1> |
| 4 | <HR> |
| 5 | |
| 6 | This set of documents provides an introduction to various aspects of |
| 7 | Python programming on the Mac. It is assumed that the reader is |
| 8 | already familiar with Python and, to some extent, with MacOS Toolbox |
| 9 | programming. Other readers may find something interesting here too, |
| 10 | your mileage may vary. <p> |
| 11 | |
Jack Jansen | 5f962c2 | 1996-04-10 14:52:59 +0000 | [diff] [blame] | 12 | There is a companion document <a href="using.html">Using Python on the Mac</a> |
| 13 | which you should read before starting here: it explains the basics of using |
| 14 | python on the Macintosh. <p> |
| 15 | |
Jack Jansen | a630813 | 1996-03-18 13:38:52 +0000 | [diff] [blame] | 16 | Another set of Macintosh-savvy examples, more aimed at beginners, is |
| 17 | maintained by Joseph Strout, at <A |
| 18 | HREF="http://www-acs.ucsd.edu/~jstrout/python/"> |
| 19 | http://www-acs.ucsd.edu/~jstrout/python/</A>. |
| 20 | <P> |
| 21 | |
Jack Jansen | 024a387 | 1996-07-18 16:07:05 +0000 | [diff] [blame] | 22 | The <a href="http://www.python.org/doc/lib/Top.html">Python Library Reference</a> contains a section on |
| 23 | <a href="http://www.python.org/doc/lib/Macintosh-Specific-Services.html">Macintosh-specific modules</a> |
| 24 | that you should also read. Documentation is also available in PostScript and other |
| 25 | forms, see the <a href="http://www.python.org/doc/">documentation</a> section |
| 26 | on the webserver. <p> |
| 27 | |
Jack Jansen | 0836542 | 1996-04-19 15:56:08 +0000 | [diff] [blame] | 28 | Some of these documents were actually written while I was working on a "real" |
Jack Jansen | a630813 | 1996-03-18 13:38:52 +0000 | [diff] [blame] | 29 | project: creating a single-button application that will allow my |
| 30 | girlfriend to read her mail (which actually pass thry <EM>my</EM> |
| 31 | mailbox, so I get to read it too, but don't tell her:-) without her |
| 32 | having to worry about internet connections, unix commands, etc. The |
| 33 | application, when finished, will connect to the net using InterSLIP, |
| 34 | start a (pseudo-)POP server on unix using rsh and use AppleScript to |
| 35 | tell Eudora to connect to that server and retrieve messages. <p> |
| 36 | |
Jack Jansen | 4122216 | 1996-05-20 11:32:49 +0000 | [diff] [blame] | 37 | These examples were all built using Python 1.3.3, which can be downloaded |
| 38 | from <a href="ftp://ftp.cwi.nl/pub/jack/python/mac">ftp.cwi.nl, directory |
| 39 | /pub/jack/python/mac</a>, and possibly from the <a href="ftp://ftp.python/org"> |
| 40 | ftp.python.org</a> server and its mirrors as well. Some examples may work |
| 41 | with earlier versions of Python, some will definitely not. |
Jack Jansen | a630813 | 1996-03-18 13:38:52 +0000 | [diff] [blame] | 42 | <H2>Table of contents</H2> |
| 43 | |
| 44 | <UL> |
| 45 | <LI> |
Jack Jansen | 024a387 | 1996-07-18 16:07:05 +0000 | [diff] [blame] | 46 | <A HREF="example0.html">Using python to create Macintosh applications, |
| 47 | part zero</A> whets your appetite by showing you how to ask the user |
| 48 | for a filename, and how to display a message. It explains about end-of-line |
| 49 | confusion while doing so. |
| 50 | |
| 51 | <LI> |
Jack Jansen | a630813 | 1996-03-18 13:38:52 +0000 | [diff] [blame] | 52 | <A HREF="example1.html">Using python to create Macintosh applications, |
| 53 | part one</A> explains how to create a simple modal-dialog application |
| 54 | in Python. It also takes a glance at using the toolbox modules Res and |
| 55 | Dlg, and EasyDialogs for simple question-dialogs. |
| 56 | |
| 57 | <LI> |
| 58 | <A HREF="example2.html">Using python to create Macintosh applications, |
| 59 | part two</A> turns the previous example program into a more complete |
| 60 | mac application, using a modeless dialog, menus, etc. It also explains |
| 61 | how to create applets, standalone applications written in Python. |
| 62 | |
| 63 | <LI> |
Jack Jansen | 0836542 | 1996-04-19 15:56:08 +0000 | [diff] [blame] | 64 | <A HREF="textedit.html">Using FrameWork and TextEdit</A> shows you |
| 65 | how to use <code>FrameWork</code> application framework and the |
| 66 | <code>TextEdit</code> toolbox to build a text editor. |
| 67 | |
| 68 | <LI> |
| 69 | <A HREF="waste.html">Using WASTE</A> expands on this editor by using |
| 70 | WASTE, an extended TextEdit replacement. |
Jack Jansen | a630813 | 1996-03-18 13:38:52 +0000 | [diff] [blame] | 71 | |
| 72 | <LI> |
| 73 | <A HREF="plugins.html">Creating a C extension module on the Macintosh</A> |
| 74 | is meant for the hardcore programmer, and shows how to create an |
| 75 | extension module in C. It also handles using Modulator to create the |
| 76 | boilerplate for your module, and creating dynamically-loadable modules |
| 77 | on PowerPC Macs. |
| 78 | |
| 79 | <LI> |
| 80 | <A HREF="applescript.html">Using Open Scripting Architecture from Python</A> explains |
| 81 | how to create a Python module interfacing to a scriptable application, |
| 82 | and how to use that module in your python program. |
Jack Jansen | 4122216 | 1996-05-20 11:32:49 +0000 | [diff] [blame] | 83 | |
| 84 | <LI> |
| 85 | <A HREF="build.html">Building Mac Python from source</A> explains |
| 86 | how to build a PPC or 68K interpreter from a source distribution. |
Jack Jansen | a630813 | 1996-03-18 13:38:52 +0000 | [diff] [blame] | 87 | </UL> |
| 88 | |
Jack Jansen | 0836542 | 1996-04-19 15:56:08 +0000 | [diff] [blame] | 89 | The Python distribution contains a few more examples, all unexplained: |
| 90 | <UL> |
| 91 | <LI> |
| 92 | <I>PICTbrowse</I> is an application that locates PICT |
| 93 | resources and displays them, it demonstrates some quickdraw and the |
| 94 | resource and list managers. |
| 95 | |
| 96 | <LI> |
| 97 | <I>Imgbrowse</I> displays image files in |
| 98 | many different formats (gif, tiff, pbm, etc). It shows how to use the |
| 99 | img modules on the mac. |
| 100 | |
| 101 | <LI> |
| 102 | <I>Quicktime</I> has the standard <code>MovieInWindow</code> and |
| 103 | <code>VerySimplePlayer</code> examples, re-coded in Python. |
| 104 | |
| 105 | <LI> |
| 106 | <I>Resources</I>, <I>Sound</I> and <I>Speech</I> have some examples |
| 107 | on using the respective managers. |
| 108 | </UL> |
| 109 | |
Jack Jansen | a630813 | 1996-03-18 13:38:52 +0000 | [diff] [blame] | 110 | At some point in the (possibly distant) future, I will add chapters on |
| 111 | how to use bgen to create modules completely automatic and how to make |
| 112 | your Python program scriptable, but that will have to wait. <p> |
| 113 | |
| 114 | <HR> |
| 115 | |
| 116 | Please let me know if you miss critical information in this |
| 117 | document. I am quite sure that I will never find the time to turn it |
| 118 | into a complete MacPython programmers guide (which would probably be a |
| 119 | 400-page book instead of 5 lousy html-files), but it should contain |
| 120 | at least the information that is neither in the standard Python |
| 121 | documentation nor in Inside Mac or other Mac programmers |
| 122 | documentation. <p> |
| 123 | |
| 124 | <HR> |
| 125 | <A HREF="http://www.cwi.nl/~jack">Jack Jansen</A>, |
Jack Jansen | 024a387 | 1996-07-18 16:07:05 +0000 | [diff] [blame] | 126 | <A HREF="mailto:jack@cwi.nl">jack@cwi.nl</A>, 18-July-1996. |
| 127 | </BODY></HTML> |