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