Adding MacPython online help. Only the basics are installed, with a

placeholder for the full documentation (pointing to the online docs
and explaining you can also install them locally to make them
searchable, etc).
This commit is contained in:
Jack Jansen 2003-03-11 22:59:26 +00:00
parent 7c22132069
commit 8a0b5665c6
21 changed files with 493 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

View File

@ -0,0 +1,21 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>Python Language Documentation</title>
<meta name="generator" content="BBEdit 6.5.3">
</head>
<body>
<h1>Python Language and runtime documentation</h1>
<p>This volume of documentation is rather big (17 Megabytes) and contains
a tutorial, full description of the Python library (all the modules
and packages included), formal description of the language and more.</p>
<p>You can <a href="http://www.python.org/doc">view it online</a>, where
you can also download PDFs for printing, or you can download and install it
through the <a href="../packman.html">Package Manager</a> for viewing and
searching via Apple Help Viewer.</p>
</body>
</html>

View File

@ -0,0 +1,36 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>Python and the Finder</title>
<meta name="generator" content="BBEdit 6.5.3">
<link rel="SHORTCUT ICON" href="pythonsmall.gif">
<META NAME="AppleIcon" CONTENT="pythonsmall.gif">
</head>
<body>
<h1>Running Python scripts from the Finder</h1>
<table>
<tr>
<td>
<img src="python.gif" width="128" height="128" align="top">
</td>
<td>
<p>The application PythonLauncher will start a Python interpreter
when you drop a Python source file onto it, any file with a <tt>.py</tt>
or <tt>.pyw</tt> extension. If you set PythonLauncher as the default
application to open a file
(<a href="help:search=Changing%20the%20application%20that%20opens%20a%20file bookID=Mac%20Help">
tell me more</a>) this also works when you double click a Python script.</p>
<p>PythonLauncher has preferences per filetype for selecting
the interpreter to use, and how to launch it: in a Terminal window
or not, etc. Holding the Option key while launching your script will
bring up a window that allows changing these settings for a single
run. </p>
</td>
</tr>
</table>
<hr>
</body>
</html>

View File

@ -0,0 +1,44 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>MacPython Help</title>
<meta name="generator" content="BBEdit 6.5.3">
<link rel="SHORTCUT ICON" href="pythonsmall.gif">
<META NAME="AppleIcon" CONTENT="pythonsmall.gif">
<META NAME="AppleTitle" CONTENT="Python Help">
</head>
<body>
<h1>MacPython Help</h1>
<table>
<tr>
<td>
<img src="python.gif" width="128" height="128" align="top">
</td>
<td>
<p>Choose a topic, or enter keywords into the search field:</p>
<ul>
<li><a href="intro.html">What is MacPython?</a>
</li>
<li><a href="macpython_ide_tutorial/index.html">MacPython
Integrated Development Environment Introduction</a>
</li>
<li><a href="doc/index.html">Python Language and runtime documentation</a>
</li>
<li><a href="finder.html">Running Python scripts from the Finder</a>
</li>
<li><a href="shell.html">Running Python scripts from the Unix Shell</a>
<li><a href="packman.html">Installing additional functionality with the
Package Manager</a>
</li>
</ul>
</td>
</tr>
</table>
<hr>
</body>
</html>

View File

@ -0,0 +1,76 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>What is MacPython?</title>
<meta name="generator" content="BBEdit 6.5.3">
<link rel="SHORTCUT ICON" href="pythonsmall.gif">
<META NAME="AppleIcon" CONTENT="pythonsmall.gif">
</head>
<body>
<h1>What is MacPython?</h1>
<table>
<tr>
<td>
<img src="python.gif" width="128" height="128" align="top">
</td>
<td>
<p>Python is a programming language. MacPython is a package containing
that programming language plus Mac-specific tools and extensions.<p>
</td>
</tr>
</table>
<hr>
<h2>The Python Language</h2>
<p>The Python programming language is available for many hardware
platforms, and most general documentation is Unix- or Windows-centered. Keep
this in mind when reading the rest of this help, or information on the web.
</p>
<p>The Python website, <a href="http://www.python.org">www.python.org</a>,
has a <em>Beginners Guide</em> section including an
<a href="http://python.org/doc/essays/blurb.html">executive summary</a> on
the language and a
<a href="http://python.org/doc/essays/comparisons.html">comparison</a> of Python
to other languages.</a> Or read the (rather longwinded) Python
Tutorial in the <a href="doc/index.html">Python Language and runtime documentation</a>.</p>
<p>MacPython contains a complete <a href="shell.html">unix interpreter</a> so
if you are familiar with Python on unix you should feel right at home.</p>
<h2>MacPython additions</h2>
<p>The MacPython Integrated Development Environment (IDE) allows
easy editing, running and debugging of scripts. Read the
<a href="macpython_ide_tutorial/index.html">Introduction
to the IDE</a> to whet your appetite.</p>
<p>MacPython comes with lots of modules that allow access to
MacOS-specific technology, such as Carbon, Quicktime and AppleScript.
See the <em>Macintosh
Modules</em> section of the
<a href="doc/index.html">Python Language and runtime documentation</a>,
but please keep in mind that some information there still pertains to
Mac OS 9.
Full access to the Cocoa APIs
and tools such as Interface Builder is available separately through the
<a href="packman.html">Package Manager</a>.</p>
<p>The <a href="packman.html">Package Manager</a> also gives you access to extension
packages for cross-platform GUI development (Tkinter, wxPython, PyOpenGL),
image processing (PIL), scientific
computing (Numeric) and much more. <em>PyObjC</em> deserves a special mention: it allows
transparent access to Cocoa and Interface Builder, similar to what Java provides,
thereby making Python a first class citizen in the Mac OS X developer world. </p>
<p>Python scripts can be saved as <em>applets</em>, semi-standalone applications
that work just like a normal application. Additionally you can even create
true standalone application that have everything embedded and can be
shipped to anyone, without the need to install Python. You do <em>not</em>
need to install the Apple Developer Tools for this. </p>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,220 @@
<html>
<head>
<title>One Day of MacPython IDE Toying</title>
<link rel="SHORTCUT ICON" href="../pythonsmall.gif">
<META NAME="AppleIcon" CONTENT="../pythonsmall.gif">
</head>
<body bgcolor="#ffffff">
<h1>One Day of MacPython IDE Toying</h1>
<table>
<tr>
<td>
<img src="IDE.gif">
</td>
<td>
<p>This document gives a very basic introduction to the
MacPython Integrated Development Environment on Mac OS. It was
written specifically for MacPython 2.3 on Mac OS X, but most of
it is applicable to MacPython-OS9 too. It is based on
<a href="http://www-hkn.eecs.berkeley.edu/~dyoo/python/idle_intro/">&quot;One
Day of IDLE Toying&quot;</a> by Danny Yoo, which you should read if
you want to use the cross-platform IDLE Python development
environment.</p>
</td>
</tr>
</table>
<hr>
<br style="page-break-after: always">
<p>Ok, let's assume that we've already installed Python. (If not, we can
visit: <a href="http://www.cwi.nl/~jack/macpython.html">http://www.cwi.nl/~jack/macpython.html</a>
or <a href="http://python.org">http://python.org</a>
and download the most recent Python interpreter. Get the Mac OSX binary
installer.) The first thing we'd like to do is actually start running it!
We can do this by opening up the IDE, which should be in Applications
under the newly-created MacPython program folder: </p><p><img
src="loading_ide.gif" border=1></p>
<hr><br style="page-break-after: always">
<p>The IDE starts up and shows an interactive window: </p>
<p><img src="new_ide_window.gif"></p>
<p>If the window does not show up (because you have run the IDE before
and closed it: it remembers that between runs) open it with the <tt>Windows->Python Interactive</tt>
menu entry. <p>
<p>This is the interactive window to the IDE, it allows us to enter
commands directly into Python, and as soon as we enter a command,
Python will execute it and spit out its result back to us. We'll be
using this interactive window a lot when we're exploring Python: it's
very nice because we get back our results immediately. If it helps,
we can think of it as a very powerful calculator.</p>
<hr><br style="page-break-after: always">
<p>Let's try something now! As per tradition, let's get Python to say
the immortal words, "Hello World". <img src="hello_world.gif"
border=1></p> <p>Those '<tt>&gt;&gt;&gt</tt>' signs act as a prompt
for us: Python is ready to read in a new command by giving us that
visual cue. Also, we notice that as we enter commands, Python will
give us its output immediately.
</p>
<hr><br style="page-break-after: always">
<p>Ok, this seems pretty simple enough. Let's try a few more
commands. If we look below:</p>
<p><img src="simple_commands.gif" border=1></p>
<p>we'll see the result of running a few more commands. Don't worry
too much about knowing the exact rules for making programs yet: the
idea is that we can experiment with Python by typing in commands. If
things don't work, then we can correct the mistake, and try it
again.</p>
<p>If you got to this point, you now know enough to start playing
around with Python! Crack open one of the tutorials from the <a
href="http://python.org/doc/Newbies.html">Python For Beginners</a> web
page, and start exploring with the interpreter. No time limit here. *grin*</p>
<hr><br style="page-break-after: always">
<p>Now that we've paddled long enough, we might be asking: ok, this is
neat, but if we close down Python and start it up again, how do we get
the computer to remember what we typed?</p>
<p>The solution is a little subtle: we can't directly save what's on
the interpreter window, because it will include both our commands and
the system's responses. What we'd like is to make a prepared file,
with just our own commands, and to be able to save that file as a
document. When we're in the mood, we can later open that file and
"run" Python over it, saving us the time of retyping the whole
thing over again.</p>
<p>Let's try this. First, let's start with a clean slate by opening
up a new window.</p>
<p><img src="making_new_window.gif" border=1></p>
<p>Here's the result of that menu command:</p>
<p><img src="new_window_made.gif" border=1></p>
<p>We notice that there's nothing in this new window. What this means
is that this file is purely for our commands: Python won't interject
with its own responses as we enter the program, that is, not until we
tell it to. This is called an edit window, and it is very similar
to edit windows in other editors such as TextEdit or BBEdit.</p>
<hr><br style="page-break-after: always">
<p>What we wanted to do before was save some of the stuff we had
tried out on the interpreter window. Let's do that by typing (or
copy/pasting) those commands into our Program window.</p>
<p><img src="entering_in_new_window.gif" border=1></p>
<p>Ok, we're done with copying and pasting.
One big thing to notice
is that we're careful to get rid of the "<tt>&gt;&gt;&gt;</tt>"
prompts because there's not really part of our program. The
interpreter uses them just to tell us that we're in the interpreter,
but now that we're editing in a separate file, we can remove the
artifacts that the interpreter introduces.
I have added
an extra empty print statement so our output ends with a newline.
</p>
<hr><br style="page-break-after: always">
<p>Let's save the file now. The Save command is located under the File menu:
<p><img src="saving_edited_file.gif" border=1></p>
<hr><br style="page-break-after: always">
<p>Now that we've saved the program, how do we run the program? Use the
Run All button at the top of the editing window, or the equivalent
menu command <tt>Python->Run Window</tt>. The output will appear in a new
window called Output Window. </p>
<p>By the way, one thing to notice is that I made a typo: I didn't
quite copy exactly what I had entered in the interpreter window
before. Does this affect things?</p>
<p><img src="syntax_error.gif" border=1></p>
<p>Ooops. Here is an example of what Python calls a "syntax error".
Python sees that we made a typo, and warns us to take a much closer
look at our program. The designers of Python feel that having the
system point out the error is better than trying to guess at what the
programmer meant. Press the Edit button and you will be brought to
the trouble spot. </p>
<p>Python is often perceptive enough to direct us toward the problem,
and in this case, it's telling us that we forgot to put something at
the end of this line. In this case, we need to add an additional
quotation mark. Let's add that in now.</p>
<p>Other errors, which usually occur later, when your program has
already done something, result in a different dialog that allows you
to look at variables and such in addition to only showing you where
the error occurred. </p>
<hr><br style="page-break-after: always">
<p>Ok, let's say that we fixed that silly typo. Let's try to run the
program again. This gives us a new window, the Output window, showing
the output of our program:</p>
<p><img src="output_window.gif" border=1></p>
<hr><br style="page-break-after: always">
<p>As we play with Python, we'll find ourselves "switching modes"
between the Interpreter window and the Program window. However,
if we try anything more complicated than two or three lines it
is often a good idea to work in an edit window, and align
your edit and output window such that you can see them at the same time.</p>
<p>This is pretty much all we need to know about the MacPython IDE to actually do
interesting things. There is a lot more to the IDE, here is a quick
breakdown of things to see and explore:</p>
<ul>
<li>All sorts of edit commands such as find and replace can be
used in the editor windows. See the edit menu.</li>
<li>The bottom of the edit window has the scrollbar, but at the
left are two navigation devices: a line number box that you can also type
numbers into to quickly go to a specific place, and a popup menu
that lists all classes, functions and methods in your file.</li>
<li>Above the vertical scrollbar you find another popup menu, this
influences how the Run command works. You should try the debugger
some time! If you do, and you wonder what the new small column on
the left of your script is: you can click in it to make Python stop
when it reaches this line so you can inspect things. The profiler
is also nifty: it shows you where your program is spending its time.</li>
<li>The module browser (<tt>Python->Module Browser</tt>) shows you all Python
modules currently loaded. You can look at the contents of the module with
Browse... and (for modules written in Python) at the source with Source...</li>
<li>The Package Manager (under the <tt>File</tt> menu, also available as a
separate application) allows you to easily install Python extension packages
for all sorts of things: scientific computation, image processing,
building user interfaces and more. </li>
<li>The <tt>Help</tt> menu gives you quick access to both the Python documentation,
if you have installed it with the Package Manager, and the Apple Developer
documentation. </li>
<li>The <tt>File->Save as Applet</tt> menu command saves your script as a MacOSX
application. This allows you to create a script that you can drop files on,
and much more. The IDE itself is such an applet, completely written in Python. </li>
</ul>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,45 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>Python Package Manager</title>
<meta name="generator" content="BBEdit 6.5.3">
<link rel="SHORTCUT ICON" href="pythonsmall.gif">
<META NAME="AppleIcon" CONTENT="pythonsmall.gif">
</head>
<body>
<h1>Installing additional Python Packages</h1>
<table>
<tr>
<td>
<img src="PackageManager.gif" width="128" height="128" align="top">
</td>
<td>
<p>The Python Package Manager helps you installing additional
packages that enhance Python. It determines the exact MacOS version
and Python version you have and uses that information to download
a database that has packages that are test and tried on that
combination. In other words: if something is in your Package Manager
window but does not work you are free to blame the database maintainer.</p>
<p>PackageManager then checks which of the packages you have installed
and which ones not. This should also work when you have installed packages
outside of PackageManager.
You can select packages and install them, and PackageManager will work
out the requirements and install these too.</p>
<p>Often PackageManager will list a package in two flavors: binary
and source. Binary should always work, source will only work if
you have installed the Apple Developer Tools. PackageManager will warn
you about this, and also about other external dependencies.</p>
<p>PackageManager is available as a separate application and also
as a function of the IDE, through the File->Package Manager menu
entry. </p>
</td>
</tr>
</table>
<hr>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

View File

@ -0,0 +1,51 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>Python and the Unix Shell</title>
<meta name="generator" content="BBEdit 6.5.3">
<link rel="SHORTCUT ICON" href="pythonsmall.gif">
<META NAME="AppleIcon" CONTENT="pythonsmall.gif">
</head>
<body>
<h1>Running Python scripts from the Unix Shell</h1>
<table>
<tr>
<td>
<img src="python.gif" width="128" height="128" align="top">
</td>
<td>
<p>MacPython 2.3 installs a perfectly normal Unix commandline
python interpreter in <tt>/usr/local/bin/python</tt>. As of Mac OS X 10.2, however,
<tt>/usr/local/bin</tt> is not on the search path of your shell. Moreover,
Apple's python 2.2, which lives in <tt>/usr/bin</tt> <em>is</em> on your
search path, so this can lead to confusion.</p>
<p>If you use <tt>tcsh</tt> you should add the following line
to the file <tt>.login</tt> in your home directory and restart Terminal:
<br>
<tt>setenv PATH /usr/local/bin:$PATH</tt>
<p>If you use <tt>bash</tt> or <tt>zsh</tt>
you should add the following line
to the file <tt>.profile</tt> in your home directory and restart Terminal:
<br>
<tt>export PATH=/usr/local/bin:$PATH</tt>
<h2>GUI scripts</h2>
<p>Due to the way MacOS handles windowing applications you need to run
<em>all</em> scripts that use the window manager (be it through
Carbon, Cocoa, Tkinter, wxPython, PyOpenGL or anything else) with the
<tt>pythonw</tt> interpreter, also installed in <tt>/usr/local/bin</tt>.</p>
<p>Running with <tt>python</tt> results in an inability to bring the
script to the front, or interacting with it. </p>
</td>
</tr>
</table>
<hr>
</body>
</html>