1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
<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>
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>
Another set of Macintosh-savvy examples, more aimed at beginners, is
maintained by Joseph Strout, at <A
HREF="http://www-acs.ucsd.edu/~jstrout/python/">
http://www-acs.ucsd.edu/~jstrout/python/</A>.
<P>
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>
Some of these documents were actually written a long time ago and have seen
little maintainance, so use with care. <p>
<H2>Table of contents</H2>
<UL>
<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.
<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.
<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.
<LI>
<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.
<LI>
<A HREF="waste.html">Using WASTE</A> expands on this editor by using
WASTE, an extended TextEdit replacement.
<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
on PowerPC Macs.
<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.
<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.
<LI>
<A HREF="building.html">Building Mac Python from source</A> explains
how to build a PPC or 68K interpreter from a source distribution.
<LI>
<A HREF="embed.html">Embedding Python on the Mac</A> is a minimal example of
how to embed Python in other Mac applications.
</UL>
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
resource and list managers. In the same folder you will find the very
similar scripts ICONbrowse and cicnbrowse.
<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
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.
<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.
</UL>
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
400-page book instead of 10 lousy html-files), but it should contain
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>,
<A HREF="mailto:jack@cwi.nl">jack@cwi.nl</A>, 26-Jun-98.
</BODY></HTML>
|