blob: 6b5806b6c767313f7b947cef025f1a37c5206fd1 [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
Jack Jansen9ca14ec2001-10-23 22:27:17 +000017maintained by Joseph Strout, at Python Tidbits in <A
18HREF="http://www.strout.net/python/">
19http://www.strout.net/python/</A>.
Jack Jansena6308131996-03-18 13:38:52 +000020<P>
21
Jack Jansen3412c5d1997-08-27 14:08:22 +000022The <a href="http://www.python.org/doc/lib/Top.html">Python Library
23Reference</a> contains a section on <a
24href="http://www.python.org/doc/lib/Macintosh-Specific-Services.html">Macintosh-specific
25modules</a> that you should also read. Documentation is also available
26in PostScript and other forms, see the <a
27href="http://www.python.org/doc/">documentation</a> section on the
28webserver. <p>
Jack Jansen024a3871996-07-18 16:07:05 +000029
Jack Jansen968cde92000-04-22 21:48:56 +000030The W widget set by Just van Rossum, which is used by the Python IDE, does not
31have complete documentation as of this writing, but Corran Webster has
32documented most of it on his
Jack Jansen2ea47f92000-04-22 22:56:09 +000033<A HREF="http://www.nevada.edu/~cwebster/Python/">Python Page</A>. <p>
34
35There are also some documentation links, as well as other MacPython-related
36pages, in the
37<A HREF="http://dmoz.org/Computers/Systems/Macintosh/Development/Scripting/Python/">
38Open Directory</A>.
Jack Jansen968cde92000-04-22 21:48:56 +000039
Jack Jansena6308131996-03-18 13:38:52 +000040
Jack Jansena6308131996-03-18 13:38:52 +000041<H2>Table of contents</H2>
42
Jack Jansen968cde92000-04-22 21:48:56 +000043<blockquote><B>Note:</B>
44Some of these documents were actually written a long time ago and have seen
45little maintainance, so use with care. </blockquote>
Jack Jansena6308131996-03-18 13:38:52 +000046<UL>
47<LI>
Jack Jansen024a3871996-07-18 16:07:05 +000048<A HREF="example0.html">Using python to create Macintosh applications,
49part zero</A> whets your appetite by showing you how to ask the user
50for a filename, and how to display a message. It explains about end-of-line
51confusion while doing so.
52
53<LI>
Jack Jansena6308131996-03-18 13:38:52 +000054<A HREF="example1.html">Using python to create Macintosh applications,
55part one</A> explains how to create a simple modal-dialog application
56in Python. It also takes a glance at using the toolbox modules Res and
57Dlg, and EasyDialogs for simple question-dialogs.
58
59<LI>
60<A HREF="example2.html">Using python to create Macintosh applications,
61part two</A> turns the previous example program into a more complete
62mac application, using a modeless dialog, menus, etc. It also explains
63how to create applets, standalone applications written in Python.
64
65<LI>
Jack Jansend9690611998-06-26 15:01:52 +000066<A HREF="freezing.html">Freezing Python programs</A> extends on this concept,
67and shows you how to create applications that can be used on machines without
68a full Python installed. This one is probably best skipped on first contact
69with MacPython.
70
71<LI>
Jack Jansen08365421996-04-19 15:56:08 +000072<A HREF="textedit.html">Using FrameWork and TextEdit</A> shows you
73how to use <code>FrameWork</code> application framework and the
74<code>TextEdit</code> toolbox to build a text editor.
75
76<LI>
77<A HREF="waste.html">Using WASTE</A> expands on this editor by using
78WASTE, an extended TextEdit replacement.
Jack Jansena6308131996-03-18 13:38:52 +000079
80<LI>
81<A HREF="plugins.html">Creating a C extension module on the Macintosh</A>
82is meant for the hardcore programmer, and shows how to create an
83extension module in C. It also handles using Modulator to create the
84boilerplate for your module, and creating dynamically-loadable modules
Jack Jansen968cde92000-04-22 21:48:56 +000085on PowerPC Macs. It assumes you use CodeWarrior for you development.
86
87<LI>
88<A HREF="mpwextensions.html">Creating C extension modules using MPW</A>
89is a companion document, written by Corran Webster, which explains how you
90can develop Python extensions using Apple's free MPW compiler environment.
Jack Jansena6308131996-03-18 13:38:52 +000091
92<LI>
93<A HREF="applescript.html">Using Open Scripting Architecture from Python</A> explains
94how to create a Python module interfacing to a scriptable application,
95and how to use that module in your python program.
Jack Jansen41222161996-05-20 11:32:49 +000096
97<LI>
Jack Jansen09da2091996-09-09 01:48:03 +000098<A HREF="cgi.html">Using python to create CGI scripts</A> is a preliminary
99introduction to writing CGI scripts in Python and to writing scriptable applications
100in Python.
101
102<LI>
Jack Jansen36389351996-08-07 13:19:16 +0000103<A HREF="building.html">Building Mac Python from source</A> explains
Jack Jansen41222161996-05-20 11:32:49 +0000104how to build a PPC or 68K interpreter from a source distribution.
Jack Jansen6ad8d131997-01-15 16:53:37 +0000105
106<LI>
107<A HREF="embed.html">Embedding Python on the Mac</A> is a minimal example of
108how to embed Python in other Mac applications.
109
Jack Jansena6308131996-03-18 13:38:52 +0000110</UL>
111
Jack Jansen08365421996-04-19 15:56:08 +0000112The Python distribution contains a few more examples, all unexplained:
113<UL>
114<LI>
115<I>PICTbrowse</I> is an application that locates PICT
116resources and displays them, it demonstrates some quickdraw and the
Jack Jansen1c4d96f1999-01-21 14:30:55 +0000117resource and list managers. In the same folder you will find the very
Jack Jansenb06007a1999-12-23 14:45:41 +0000118similar scripts ICONbrowse and cicnbrowse. oldPICTbrowse is the same program
119but form the pre-Appearance era, it uses a dialog with a user item and
120creates and manages its own List object.
Jack Jansen08365421996-04-19 15:56:08 +0000121
122<LI>
123<I>Imgbrowse</I> displays image files in
124many different formats (gif, tiff, pbm, etc). It shows how to use the
125img modules on the mac.
126
127<LI>
128<I>Quicktime</I> has the standard <code>MovieInWindow</code> and
129<code>VerySimplePlayer</code> examples, re-coded in Python.
130
131<LI>
132<I>Resources</I>, <I>Sound</I> and <I>Speech</I> have some examples
Jack Jansena2139fe1998-02-25 15:40:35 +0000133on using the respective managers. In the <i>Mac:Lib</i> folder you
134will also find modules that do useful things with the Communications
135Toolbox, the Finder interface, etc.
Jack Jansen5073b371998-04-27 15:06:50 +0000136
137<LI>
138<I>Printing</I> has an example on using the Printing module to, you guessed
139it, print from Python. The code is somewhat self-documenting. Donated
140by Just van Rossum, who also donated the Printing module itself.
Jack Jansen08365421996-04-19 15:56:08 +0000141</UL>
142
Jack Jansena6308131996-03-18 13:38:52 +0000143At some point in the (possibly distant) future, I will add chapters on
144how to use bgen to create modules completely automatic and how to make
145your Python program scriptable, but that will have to wait. <p>
146
147<HR>
148
149Please let me know if you miss critical information in this
150document. I am quite sure that I will never find the time to turn it
151into a complete MacPython programmers guide (which would probably be a
Jack Jansena2139fe1998-02-25 15:40:35 +0000152400-page book instead of 10 lousy html-files), but it should contain
Jack Jansena6308131996-03-18 13:38:52 +0000153at least the information that is neither in the standard Python
154documentation nor in Inside Mac or other Mac programmers
155documentation. <p>
156
157<HR>
158<A HREF="http://www.cwi.nl/~jack">Jack Jansen</A>,
Jack Jansen968cde92000-04-22 21:48:56 +0000159<A HREF="mailto:jack@cwi.nl">jack@cwi.nl</A>, 22-Apr-00.
Jack Jansen024a3871996-07-18 16:07:05 +0000160</BODY></HTML>