1996-03-18 09:38:52 -04:00
|
|
|
<HTML><HEAD><TITLE>Macintosh Python crash course</TITLE></HEAD>
|
|
|
|
<BODY>
|
|
|
|
<H1><IMG SRC="html.icons/python.gif">Macintosh Python crash course</H1>
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
This set of documents provides an introduction to various aspects of
|
|
|
|
Python programming on the Mac. It is assumed that the reader is
|
|
|
|
already familiar with Python and, to some extent, with MacOS Toolbox
|
|
|
|
programming. Other readers may find something interesting here too,
|
|
|
|
your mileage may vary. <p>
|
|
|
|
|
1996-04-10 11:52:59 -03:00
|
|
|
There is a companion document <a href="using.html">Using Python on the Mac</a>
|
|
|
|
which you should read before starting here: it explains the basics of using
|
|
|
|
python on the Macintosh. <p>
|
|
|
|
|
1996-03-18 09:38:52 -04:00
|
|
|
Another set of Macintosh-savvy examples, more aimed at beginners, is
|
2001-10-23 19:27:17 -03:00
|
|
|
maintained by Joseph Strout, at Python Tidbits in <A
|
|
|
|
HREF="http://www.strout.net/python/">
|
|
|
|
http://www.strout.net/python/</A>.
|
1996-03-18 09:38:52 -04:00
|
|
|
<P>
|
|
|
|
|
1997-08-27 11:08:22 -03:00
|
|
|
The <a href="http://www.python.org/doc/lib/Top.html">Python Library
|
|
|
|
Reference</a> contains a section on <a
|
|
|
|
href="http://www.python.org/doc/lib/Macintosh-Specific-Services.html">Macintosh-specific
|
|
|
|
modules</a> that you should also read. Documentation is also available
|
|
|
|
in PostScript and other forms, see the <a
|
|
|
|
href="http://www.python.org/doc/">documentation</a> section on the
|
|
|
|
webserver. <p>
|
|
|
|
|
2000-04-22 18:48:56 -03:00
|
|
|
The W widget set by Just van Rossum, which is used by the Python IDE, does not
|
|
|
|
have complete documentation as of this writing, but Corran Webster has
|
|
|
|
documented most of it on his
|
2000-04-22 19:56:09 -03:00
|
|
|
<A HREF="http://www.nevada.edu/~cwebster/Python/">Python Page</A>. <p>
|
|
|
|
|
|
|
|
There are also some documentation links, as well as other MacPython-related
|
|
|
|
pages, in the
|
|
|
|
<A HREF="http://dmoz.org/Computers/Systems/Macintosh/Development/Scripting/Python/">
|
|
|
|
Open Directory</A>.
|
2000-04-22 18:48:56 -03:00
|
|
|
|
1997-08-27 11:08:22 -03:00
|
|
|
|
1996-03-18 09:38:52 -04:00
|
|
|
<H2>Table of contents</H2>
|
|
|
|
|
2000-04-22 18:48:56 -03:00
|
|
|
<blockquote><B>Note:</B>
|
|
|
|
Some of these documents were actually written a long time ago and have seen
|
|
|
|
little maintainance, so use with care. </blockquote>
|
1996-03-18 09:38:52 -04:00
|
|
|
<UL>
|
1996-07-18 13:07:05 -03:00
|
|
|
<LI>
|
|
|
|
<A HREF="example0.html">Using python to create Macintosh applications,
|
|
|
|
part zero</A> whets your appetite by showing you how to ask the user
|
|
|
|
for a filename, and how to display a message. It explains about end-of-line
|
|
|
|
confusion while doing so.
|
|
|
|
|
1996-03-18 09:38:52 -04:00
|
|
|
<LI>
|
|
|
|
<A HREF="example1.html">Using python to create Macintosh applications,
|
|
|
|
part one</A> explains how to create a simple modal-dialog application
|
|
|
|
in Python. It also takes a glance at using the toolbox modules Res and
|
|
|
|
Dlg, and EasyDialogs for simple question-dialogs.
|
|
|
|
|
|
|
|
<LI>
|
|
|
|
<A HREF="example2.html">Using python to create Macintosh applications,
|
|
|
|
part two</A> turns the previous example program into a more complete
|
|
|
|
mac application, using a modeless dialog, menus, etc. It also explains
|
|
|
|
how to create applets, standalone applications written in Python.
|
|
|
|
|
1998-06-26 12:01:52 -03:00
|
|
|
<LI>
|
|
|
|
<A HREF="freezing.html">Freezing Python programs</A> extends on this concept,
|
|
|
|
and shows you how to create applications that can be used on machines without
|
|
|
|
a full Python installed. This one is probably best skipped on first contact
|
|
|
|
with MacPython.
|
|
|
|
|
1996-03-18 09:38:52 -04:00
|
|
|
<LI>
|
1996-04-19 12:56:08 -03:00
|
|
|
<A HREF="textedit.html">Using FrameWork and TextEdit</A> shows you
|
|
|
|
how to use <code>FrameWork</code> application framework and the
|
|
|
|
<code>TextEdit</code> toolbox to build a text editor.
|
|
|
|
|
1996-03-18 09:38:52 -04:00
|
|
|
<LI>
|
|
|
|
<A HREF="plugins.html">Creating a C extension module on the Macintosh</A>
|
|
|
|
is meant for the hardcore programmer, and shows how to create an
|
|
|
|
extension module in C. It also handles using Modulator to create the
|
|
|
|
boilerplate for your module, and creating dynamically-loadable modules
|
2000-04-22 18:48:56 -03:00
|
|
|
on PowerPC Macs. It assumes you use CodeWarrior for you development.
|
|
|
|
|
|
|
|
<LI>
|
|
|
|
<A HREF="mpwextensions.html">Creating C extension modules using MPW</A>
|
|
|
|
is a companion document, written by Corran Webster, which explains how you
|
|
|
|
can develop Python extensions using Apple's free MPW compiler environment.
|
1996-03-18 09:38:52 -04:00
|
|
|
|
|
|
|
<LI>
|
|
|
|
<A HREF="applescript.html">Using Open Scripting Architecture from Python</A> explains
|
|
|
|
how to create a Python module interfacing to a scriptable application,
|
|
|
|
and how to use that module in your python program.
|
1996-05-20 08:32:49 -03:00
|
|
|
|
1996-09-08 22:48:03 -03:00
|
|
|
<LI>
|
|
|
|
<A HREF="cgi.html">Using python to create CGI scripts</A> is a preliminary
|
|
|
|
introduction to writing CGI scripts in Python and to writing scriptable applications
|
|
|
|
in Python.
|
|
|
|
|
1996-05-20 08:32:49 -03:00
|
|
|
<LI>
|
1996-08-07 10:19:16 -03:00
|
|
|
<A HREF="building.html">Building Mac Python from source</A> explains
|
1996-05-20 08:32:49 -03:00
|
|
|
how to build a PPC or 68K interpreter from a source distribution.
|
1997-01-15 12:53:37 -04:00
|
|
|
|
|
|
|
<LI>
|
|
|
|
<A HREF="embed.html">Embedding Python on the Mac</A> is a minimal example of
|
|
|
|
how to embed Python in other Mac applications.
|
|
|
|
|
1996-03-18 09:38:52 -04:00
|
|
|
</UL>
|
|
|
|
|
1996-04-19 12:56:08 -03:00
|
|
|
The Python distribution contains a few more examples, all unexplained:
|
|
|
|
<UL>
|
|
|
|
<LI>
|
|
|
|
<I>PICTbrowse</I> is an application that locates PICT
|
|
|
|
resources and displays them, it demonstrates some quickdraw and the
|
1999-01-21 10:30:55 -04:00
|
|
|
resource and list managers. In the same folder you will find the very
|
1999-12-23 10:45:41 -04:00
|
|
|
similar scripts ICONbrowse and cicnbrowse. oldPICTbrowse is the same program
|
|
|
|
but form the pre-Appearance era, it uses a dialog with a user item and
|
|
|
|
creates and manages its own List object.
|
1996-04-19 12:56:08 -03:00
|
|
|
|
|
|
|
<LI>
|
|
|
|
<I>Imgbrowse</I> displays image files in
|
|
|
|
many different formats (gif, tiff, pbm, etc). It shows how to use the
|
|
|
|
img modules on the mac.
|
|
|
|
|
|
|
|
<LI>
|
|
|
|
<I>Quicktime</I> has the standard <code>MovieInWindow</code> and
|
|
|
|
<code>VerySimplePlayer</code> examples, re-coded in Python.
|
|
|
|
|
|
|
|
<LI>
|
|
|
|
<I>Resources</I>, <I>Sound</I> and <I>Speech</I> have some examples
|
1998-02-25 11:40:35 -04:00
|
|
|
on using the respective managers. In the <i>Mac:Lib</i> folder you
|
|
|
|
will also find modules that do useful things with the Communications
|
|
|
|
Toolbox, the Finder interface, etc.
|
1998-04-27 12:06:50 -03:00
|
|
|
|
|
|
|
<LI>
|
|
|
|
<I>Printing</I> has an example on using the Printing module to, you guessed
|
|
|
|
it, print from Python. The code is somewhat self-documenting. Donated
|
|
|
|
by Just van Rossum, who also donated the Printing module itself.
|
1996-04-19 12:56:08 -03:00
|
|
|
</UL>
|
|
|
|
|
1996-03-18 09:38:52 -04:00
|
|
|
At some point in the (possibly distant) future, I will add chapters on
|
|
|
|
how to use bgen to create modules completely automatic and how to make
|
|
|
|
your Python program scriptable, but that will have to wait. <p>
|
|
|
|
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
Please let me know if you miss critical information in this
|
|
|
|
document. I am quite sure that I will never find the time to turn it
|
|
|
|
into a complete MacPython programmers guide (which would probably be a
|
1998-02-25 11:40:35 -04:00
|
|
|
400-page book instead of 10 lousy html-files), but it should contain
|
1996-03-18 09:38:52 -04:00
|
|
|
at least the information that is neither in the standard Python
|
|
|
|
documentation nor in Inside Mac or other Mac programmers
|
|
|
|
documentation. <p>
|
|
|
|
|
|
|
|
<HR>
|
|
|
|
<A HREF="http://www.cwi.nl/~jack">Jack Jansen</A>,
|
2000-04-22 18:48:56 -03:00
|
|
|
<A HREF="mailto:jack@cwi.nl">jack@cwi.nl</A>, 22-Apr-00.
|
1996-07-18 13:07:05 -03:00
|
|
|
</BODY></HTML>
|