blob: fda20b7aca0b07026a72c89174d4e9c37eef568f [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
22The document was actually written while I was working on a "real"
23project: 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
31<CITE>
32If you want to try the examples here you will have to download some
33fixes to the 1.3 distribution to your Macintosh. You need an updated
34version of <A HREF="update-to-1.3/FrameWork.py">FrameWork.py</A> (to
35go in <CODE>Lib:mac</CODE> and updated <A
36HREF="update-to-1.3/into-PlugIns.hqx">project templates</A> to go into
37the <CODE>PlugIns</CODE> folder for PPC users.
38Users of 1.3.1 or later distributions don't need these fixes.<P>
39</CITE>
40
41If you are reading this document on the web and would prefer to read
42it offline you can transfer the whole stuff (as a BinHexed StuffIt
43archive) from <A HREF="complete.hqx"> here</A>. This archive includes
44the fixes mentioned in the previous paragraph. <p>
45
46<H2>Table of contents</H2>
47
48<UL>
49<LI>
50<A HREF="example1.html">Using python to create Macintosh applications,
51part one</A> explains how to create a simple modal-dialog application
52in Python. It also takes a glance at using the toolbox modules Res and
53Dlg, and EasyDialogs for simple question-dialogs.
54
55<LI>
56<A HREF="example2.html">Using python to create Macintosh applications,
57part two</A> turns the previous example program into a more complete
58mac application, using a modeless dialog, menus, etc. It also explains
59how to create applets, standalone applications written in Python.
60
61<LI>
62In the Python distribution two more examples are included without
63explanation. <I>PICTbrowse</I> is an application that locates PICT
64resources and displays them, it demonstrates some quickdraw and the
65resource and list namagers. <I>Imgbrowse</I> displays image files in
66many different formats (gif, tiff, pbm, etc). It shows how to use the
67img modules on the mac.
68
69<LI>
70<A HREF="plugins.html">Creating a C extension module on the Macintosh</A>
71is meant for the hardcore programmer, and shows how to create an
72extension module in C. It also handles using Modulator to create the
73boilerplate for your module, and creating dynamically-loadable modules
74on PowerPC Macs.
75
76<LI>
77<A HREF="applescript.html">Using Open Scripting Architecture from Python</A> explains
78how to create a Python module interfacing to a scriptable application,
79and how to use that module in your python program.
80</UL>
81
82At some point in the (possibly distant) future, I will add chapters on
83how to use bgen to create modules completely automatic and how to make
84your Python program scriptable, but that will have to wait. <p>
85
86<HR>
87
88Please let me know if you miss critical information in this
89document. I am quite sure that I will never find the time to turn it
90into a complete MacPython programmers guide (which would probably be a
91400-page book instead of 5 lousy html-files), but it should contain
92at least the information that is neither in the standard Python
93documentation nor in Inside Mac or other Mac programmers
94documentation. <p>
95
96<HR>
97<A HREF="http://www.cwi.nl/~jack">Jack Jansen</A>,
Jack Jansen5f962c21996-04-10 14:52:59 +000098<A HREF="mailto:jack@cwi.nl">jack@cwi.nl</A>, 7-Apr-1996.