| Jack Jansen | a630813 | 1996-03-18 13:38:52 +0000 | [diff] [blame] | 1 | <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 |  | 
| Ronald Oussoren | f3f31ab | 2006-06-25 21:14:19 +0000 | [diff] [blame^] | 6 | <p>This set of documents provides an introduction to various aspects of | 
| Jack Jansen | a630813 | 1996-03-18 13:38:52 +0000 | [diff] [blame] | 7 | Python programming on the Mac. It is assumed that the reader is | 
|  | 8 | already familiar with Python and, to some extent, with MacOS Toolbox | 
|  | 9 | programming. Other readers may find something interesting here too, | 
| Ronald Oussoren | f3f31ab | 2006-06-25 21:14:19 +0000 | [diff] [blame^] | 10 | your mileage may vary. </p> | 
| Jack Jansen | a630813 | 1996-03-18 13:38:52 +0000 | [diff] [blame] | 11 |  | 
| Ronald Oussoren | f3f31ab | 2006-06-25 21:14:19 +0000 | [diff] [blame^] | 12 | <p>As the previous paragraph reveals to the careful observer these examples | 
|  | 13 | are dated, most of them were writting before OSX and haven't been updated | 
|  | 14 | afterwards. They still show how to use the Carbon wrappers but aren't | 
|  | 15 | necessarily the best way to use the Carbon API's in OSX.</p> | 
| Jack Jansen | 5f962c2 | 1996-04-10 14:52:59 +0000 | [diff] [blame] | 16 |  | 
| Jack Jansen | a630813 | 1996-03-18 13:38:52 +0000 | [diff] [blame] | 17 | Another set of Macintosh-savvy examples, more aimed at beginners, is | 
| Jack Jansen | 9ca14ec | 2001-10-23 22:27:17 +0000 | [diff] [blame] | 18 | maintained by Joseph Strout, at Python Tidbits in <A | 
|  | 19 | HREF="http://www.strout.net/python/"> | 
|  | 20 | http://www.strout.net/python/</A>. | 
| Jack Jansen | a630813 | 1996-03-18 13:38:52 +0000 | [diff] [blame] | 21 | <P> | 
|  | 22 |  | 
| Jack Jansen | 3412c5d | 1997-08-27 14:08:22 +0000 | [diff] [blame] | 23 | The <a href="http://www.python.org/doc/lib/Top.html">Python Library | 
|  | 24 | Reference</a> contains a section on <a | 
|  | 25 | href="http://www.python.org/doc/lib/Macintosh-Specific-Services.html">Macintosh-specific | 
|  | 26 | modules</a> that you should also read. Documentation is also available | 
|  | 27 | in PostScript and other forms, see the <a | 
|  | 28 | href="http://www.python.org/doc/">documentation</a> section on the | 
|  | 29 | webserver. <p> | 
| Jack Jansen | 024a387 | 1996-07-18 16:07:05 +0000 | [diff] [blame] | 30 |  | 
| Ronald Oussoren | f3f31ab | 2006-06-25 21:14:19 +0000 | [diff] [blame^] | 31 | <p>The W widget set by Just van Rossum, does not have complete documentation as | 
|  | 32 | of this writing, but Corran Webster has documented most of it on his | 
|  | 33 | <A HREF="http://www.nevada.edu/~cwebster/Python/">Python Page</A>.</p> | 
| Jack Jansen | 2ea47f9 | 2000-04-22 22:56:09 +0000 | [diff] [blame] | 34 |  | 
|  | 35 | There are also some documentation links, as well as other MacPython-related | 
|  | 36 | pages, in the | 
|  | 37 | <A HREF="http://dmoz.org/Computers/Systems/Macintosh/Development/Scripting/Python/"> | 
|  | 38 | Open Directory</A>. | 
| Jack Jansen | 968cde9 | 2000-04-22 21:48:56 +0000 | [diff] [blame] | 39 |  | 
| Jack Jansen | a630813 | 1996-03-18 13:38:52 +0000 | [diff] [blame] | 40 |  | 
| Jack Jansen | a630813 | 1996-03-18 13:38:52 +0000 | [diff] [blame] | 41 | <H2>Table of contents</H2> | 
|  | 42 |  | 
| Jack Jansen | 968cde9 | 2000-04-22 21:48:56 +0000 | [diff] [blame] | 43 | <blockquote><B>Note:</B> | 
|  | 44 | Some of these documents were actually written a long time ago and have seen | 
|  | 45 | little maintainance, so use with care. </blockquote> | 
| Jack Jansen | a630813 | 1996-03-18 13:38:52 +0000 | [diff] [blame] | 46 | <UL> | 
|  | 47 | <LI> | 
| Jack Jansen | 024a387 | 1996-07-18 16:07:05 +0000 | [diff] [blame] | 48 | <A HREF="example0.html">Using python to create Macintosh applications, | 
|  | 49 | part zero</A> whets your appetite by showing you how to ask the user | 
|  | 50 | for a filename, and how to display a message. It explains about end-of-line | 
|  | 51 | confusion while doing so. | 
|  | 52 |  | 
|  | 53 | <LI> | 
| Jack Jansen | a630813 | 1996-03-18 13:38:52 +0000 | [diff] [blame] | 54 | <A HREF="example1.html">Using python to create Macintosh applications, | 
|  | 55 | part one</A> explains how to create a simple modal-dialog application | 
|  | 56 | in Python. It also takes a glance at using the toolbox modules Res and | 
|  | 57 | Dlg, and EasyDialogs for simple question-dialogs. | 
|  | 58 |  | 
|  | 59 | <LI> | 
|  | 60 | <A HREF="example2.html">Using python to create Macintosh applications, | 
|  | 61 | part two</A> turns the previous example program into a more complete | 
|  | 62 | mac application, using a modeless dialog, menus, etc. It also explains | 
|  | 63 | how to create applets, standalone applications written in Python. | 
|  | 64 |  | 
|  | 65 | <LI> | 
| Jack Jansen | d969061 | 1998-06-26 15:01:52 +0000 | [diff] [blame] | 66 | <A HREF="freezing.html">Freezing Python programs</A> extends on this concept, | 
|  | 67 | and shows you how to create applications that can be used on machines without | 
|  | 68 | a full Python installed. This one is probably best skipped on first contact | 
|  | 69 | with MacPython. | 
|  | 70 |  | 
|  | 71 | <LI> | 
| Jack Jansen | 0836542 | 1996-04-19 15:56:08 +0000 | [diff] [blame] | 72 | <A HREF="textedit.html">Using FrameWork and TextEdit</A> shows you | 
|  | 73 | how to use <code>FrameWork</code> application framework and the | 
|  | 74 | <code>TextEdit</code> toolbox to build a text editor. | 
|  | 75 |  | 
|  | 76 | <LI> | 
| Jack Jansen | a630813 | 1996-03-18 13:38:52 +0000 | [diff] [blame] | 77 | <A HREF="plugins.html">Creating a C extension module on the Macintosh</A> | 
|  | 78 | is meant for the hardcore programmer, and shows how to create an | 
|  | 79 | extension module in C. It also handles using Modulator to create the | 
|  | 80 | boilerplate for your module, and creating dynamically-loadable modules | 
| Jack Jansen | 968cde9 | 2000-04-22 21:48:56 +0000 | [diff] [blame] | 81 | on PowerPC Macs. It assumes you use CodeWarrior for you development. | 
|  | 82 |  | 
|  | 83 | <LI> | 
|  | 84 | <A HREF="mpwextensions.html">Creating C extension modules using MPW</A> | 
|  | 85 | is a companion document, written by Corran Webster, which explains how you | 
|  | 86 | can develop Python extensions using Apple's free MPW compiler environment. | 
| Jack Jansen | a630813 | 1996-03-18 13:38:52 +0000 | [diff] [blame] | 87 |  | 
|  | 88 | <LI> | 
|  | 89 | <A HREF="applescript.html">Using Open Scripting Architecture from Python</A> explains | 
|  | 90 | how to create a Python module interfacing to a scriptable application, | 
|  | 91 | and how to use that module in your python program. | 
| Jack Jansen | 4122216 | 1996-05-20 11:32:49 +0000 | [diff] [blame] | 92 |  | 
|  | 93 | <LI> | 
| Jack Jansen | 09da209 | 1996-09-09 01:48:03 +0000 | [diff] [blame] | 94 | <A HREF="cgi.html">Using python to create CGI scripts</A> is a preliminary | 
|  | 95 | introduction to writing CGI scripts in Python and to writing scriptable applications | 
|  | 96 | in Python. | 
|  | 97 |  | 
|  | 98 | <LI> | 
| Jack Jansen | 3638935 | 1996-08-07 13:19:16 +0000 | [diff] [blame] | 99 | <A HREF="building.html">Building Mac Python from source</A> explains | 
| Jack Jansen | 4122216 | 1996-05-20 11:32:49 +0000 | [diff] [blame] | 100 | how to build a PPC or 68K interpreter from a source distribution. | 
| Jack Jansen | 6ad8d13 | 1997-01-15 16:53:37 +0000 | [diff] [blame] | 101 |  | 
|  | 102 | <LI> | 
|  | 103 | <A HREF="embed.html">Embedding Python on the Mac</A> is a minimal example of | 
|  | 104 | how to embed Python in other Mac applications. | 
|  | 105 |  | 
| Jack Jansen | a630813 | 1996-03-18 13:38:52 +0000 | [diff] [blame] | 106 | </UL> | 
|  | 107 |  | 
| Jack Jansen | 0836542 | 1996-04-19 15:56:08 +0000 | [diff] [blame] | 108 | The Python distribution contains a few more examples, all unexplained: | 
|  | 109 | <UL> | 
|  | 110 | <LI> | 
|  | 111 | <I>PICTbrowse</I> is an application that locates PICT | 
|  | 112 | resources and displays them, it demonstrates some quickdraw and the | 
| Jack Jansen | 1c4d96f | 1999-01-21 14:30:55 +0000 | [diff] [blame] | 113 | resource and list managers. In the same folder you will find the very | 
| Jack Jansen | b06007a | 1999-12-23 14:45:41 +0000 | [diff] [blame] | 114 | similar scripts ICONbrowse and cicnbrowse. oldPICTbrowse is the same program | 
|  | 115 | but form the pre-Appearance era, it uses a dialog with a user item and | 
|  | 116 | creates and manages its own List object. | 
| Jack Jansen | 0836542 | 1996-04-19 15:56:08 +0000 | [diff] [blame] | 117 |  | 
|  | 118 | <LI> | 
|  | 119 | <I>Imgbrowse</I> displays image files in | 
|  | 120 | many different formats (gif, tiff, pbm, etc). It shows how to use the | 
|  | 121 | img modules on the mac. | 
|  | 122 |  | 
|  | 123 | <LI> | 
|  | 124 | <I>Quicktime</I> has the standard <code>MovieInWindow</code> and | 
|  | 125 | <code>VerySimplePlayer</code> examples, re-coded in Python. | 
|  | 126 |  | 
|  | 127 | <LI> | 
|  | 128 | <I>Resources</I>, <I>Sound</I> and <I>Speech</I> have some examples | 
| Jack Jansen | a2139fe | 1998-02-25 15:40:35 +0000 | [diff] [blame] | 129 | on using the respective managers. In the <i>Mac:Lib</i> folder you | 
|  | 130 | will also find modules that do useful things with the Communications | 
|  | 131 | Toolbox, the Finder interface, etc. | 
| Jack Jansen | 5073b37 | 1998-04-27 15:06:50 +0000 | [diff] [blame] | 132 |  | 
|  | 133 | <LI> | 
|  | 134 | <I>Printing</I> has an example on using the Printing module to, you guessed | 
|  | 135 | it, print from Python. The code is somewhat self-documenting. Donated | 
|  | 136 | by Just van Rossum, who also donated the Printing module itself. | 
| Jack Jansen | 0836542 | 1996-04-19 15:56:08 +0000 | [diff] [blame] | 137 | </UL> | 
|  | 138 |  | 
| Jack Jansen | a630813 | 1996-03-18 13:38:52 +0000 | [diff] [blame] | 139 | At some point in the (possibly distant) future, I will add chapters on | 
|  | 140 | how to use bgen to create modules completely automatic and how to make | 
|  | 141 | your Python program scriptable, but that will have to wait. <p> | 
|  | 142 |  | 
|  | 143 | <HR> | 
|  | 144 |  | 
|  | 145 | Please let me know if you miss critical information in this | 
|  | 146 | document. I am quite sure that I will never find the time to turn it | 
|  | 147 | into a complete MacPython programmers guide (which would probably be a | 
| Jack Jansen | a2139fe | 1998-02-25 15:40:35 +0000 | [diff] [blame] | 148 | 400-page book instead of 10 lousy html-files), but it should contain | 
| Jack Jansen | a630813 | 1996-03-18 13:38:52 +0000 | [diff] [blame] | 149 | at least the information that is neither in the standard Python | 
|  | 150 | documentation nor in Inside Mac or other Mac programmers | 
|  | 151 | documentation. <p> | 
|  | 152 |  | 
|  | 153 | <HR> | 
|  | 154 | <A HREF="http://www.cwi.nl/~jack">Jack Jansen</A>, | 
| Jack Jansen | 968cde9 | 2000-04-22 21:48:56 +0000 | [diff] [blame] | 155 | <A HREF="mailto:jack@cwi.nl">jack@cwi.nl</A>, 22-Apr-00. | 
| Jack Jansen | 024a387 | 1996-07-18 16:07:05 +0000 | [diff] [blame] | 156 | </BODY></HTML> |