parent
fc3542f678
commit
0b1b5adaee
|
@ -0,0 +1,62 @@
|
|||
<!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>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="python.gif" width="128" height="128" align="top" alt="">
|
||||
</td>
|
||||
<td>
|
||||
<h1>MacPython Community</h1>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr>
|
||||
|
||||
<h2>Web Sites</h2>
|
||||
|
||||
<p>The MacPython homepage, <a href="http://www.cwi.nl/~jack/macpython.html">
|
||||
www.cwi.nl/~jack/macpython.html</a>
|
||||
is where you can find installers, documents, links to useful packages and more.
|
||||
And, of course,
|
||||
<a href="http://www.python.org">www.python.org</a> has a much larger collection
|
||||
of material on Python that is not Mac-specific.</p>
|
||||
|
||||
<h2>News groups and Mailing lists</h2>
|
||||
|
||||
<p>There are a lot of mailing lists on Python. Some of the more interesting
|
||||
ones are:</p>
|
||||
<ul>
|
||||
<li><a href="mailto:python-help@python.org">python-help@python.org</a> where
|
||||
you can send questions for individual support. Please check the websites mentioned
|
||||
above first, though!</li>
|
||||
<li>The <a href="news:comp.lang.python">comp.lang.python</a> newsgroup for general
|
||||
discussion. Also available as a
|
||||
<a href="http://www.python.org/mailman/listinfo/python-list">mailing list</a>.</li>
|
||||
<li>The <a href="news:comp.lang.python.announce">comp.lang.python.announce</a>
|
||||
newsgroup for announcements. Low-volume and moderated. Also available as a
|
||||
<a href="http://www.python.org/mailman/listinfo/python-announce-list">mailing list</a>.</li>
|
||||
<li>Last but not least, the <a href="http://www.python.org/sigs/pythonmac-sig/">pythonmac-sig</a>
|
||||
mailing list is specifically for MacPython. Discussions on the implementation of new
|
||||
features, but beginners questions are welcome too.</li>
|
||||
</ul>
|
||||
|
||||
<p>In addition there are Python <a href="http://www.python.org/sigs/">Special Interest Group</a>
|
||||
mailing lists on a wide variety of topics such as image processing, numerical algorithms
|
||||
and more.</p>
|
||||
|
||||
<h2>More</h2>
|
||||
|
||||
<p>An index of conferences, Wiki's, bookshops and more can be found at the
|
||||
<a href="http://www.python.org/psa/">Community</a> section of the Python website.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -13,7 +13,7 @@
|
|||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="python.gif" width="128" height="128" align="top">
|
||||
<img src="python.gif" width="128" height="128" align="top" alt="">
|
||||
</td>
|
||||
<td>
|
||||
<p>The application PythonLauncher will start a Python interpreter
|
||||
|
|
|
@ -21,12 +21,11 @@ for your Python code, each of which has its own merits:</p>
|
|||
Library section of the <a href="doc/index.html">Python Language and runtime
|
||||
documentation</a> and the Human Interface Toolbox section of
|
||||
<a href="help:openbook=Carbon">Apple's Carbon Documentation</a>.
|
||||
This solution is compatible with MacPython-OS9.
|
||||
|
||||
This solution is compatible with MacPython-OS9.</li>
|
||||
<li> The <tt>W</tt> framework is built on top of this, and easier to use.
|
||||
The MacPython IDE uses W. Some documentation is available on
|
||||
<a href="http://www.nevada.edu/~cwebster/Python/index.html">Corran Webster's website</a>.
|
||||
Compatible with MacPython-OS9.
|
||||
Compatible with MacPython-OS9.</li>
|
||||
</ul>
|
||||
|
||||
<p>For new work, however, one of the following packages may be better suited.
|
||||
|
@ -38,17 +37,17 @@ can install them through the <a href="packman.html">Package Manager</a>:</p>
|
|||
In technical terms it is a
|
||||
bidirectional bridge between Python and Objectve-C, similar to Apple's Java
|
||||
bridge. Probably the best choice for Mac OS X-only applications, but at the
|
||||
time of this writing PyObjC is still in beta.
|
||||
time of this writing PyObjC is still in beta.</li>
|
||||
|
||||
<li> <a href="http://wxpython.sourceforge.net/">wxPython</a> gives Python programs
|
||||
access to the wxWindows GUI toolkit. Many people consider this
|
||||
the best open source cross-platform GUI solution available today.
|
||||
the best open source cross-platform GUI solution available today.</li>
|
||||
|
||||
<li> Tkinter is the oldest cross-platform GUI toolkit for Python, bridging Python
|
||||
to Tcl/Tk. If you install AquaTk it creates a native user interface on Mac OS X.
|
||||
Documented in the Library section, Tkinter subsection of the
|
||||
<a href="doc/index.html">Python Language and runtime documentation</a>. Tkinter
|
||||
is not available for MacPython-OS9.
|
||||
is not available for MacPython-OS9.</li>
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="python.gif" width="128" height="128" align="top">
|
||||
<img src="python.gif" width="128" height="128" align="top" alt="">
|
||||
</td>
|
||||
<td>
|
||||
<p>Choose a topic, or enter keywords into the search field:</p>
|
||||
|
@ -30,11 +30,16 @@
|
|||
<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>
|
||||
<li><a href="gui.html">Creating a User Interface with MacPython</a>
|
||||
</li>
|
||||
<li><a href="scripting.html">Controlling other Applications from MacPython</a>
|
||||
</li>
|
||||
<li><a href="packman.html">Installing additional functionality with the
|
||||
Package Manager</a>
|
||||
</li>
|
||||
<li><a href="community.html">MacPython community</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</td>
|
||||
|
|
|
@ -13,11 +13,11 @@
|
|||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="python.gif" width="128" height="128" align="top">
|
||||
<img src="python.gif" width="128" height="128" align="top" alt="">
|
||||
</td>
|
||||
<td>
|
||||
<p>Python is a programming language. MacPython is a package containing
|
||||
that programming language plus Mac-specific tools and extensions.<p>
|
||||
that programming language plus Mac-specific tools and extensions.</p>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -35,7 +35,7 @@ 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
|
||||
to other languages. 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
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<html>
|
||||
<!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>
|
||||
<title>One Day of MacPython IDE Toying</title>
|
||||
<link rel="SHORTCUT ICON" href="../pythonsmall.gif">
|
||||
|
@ -9,7 +11,7 @@
|
|||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="IDE.gif">
|
||||
<img src="IDE.gif" alt="">
|
||||
</td>
|
||||
<td>
|
||||
<p>This document gives a very basic introduction to the
|
||||
|
@ -34,16 +36,16 @@ 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>
|
||||
src="loading_ide.gif" border=1 alt="image of IDE icon"></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><img src="new_ide_window.gif" alt="image of new window"></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>
|
||||
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,
|
||||
|
@ -56,7 +58,7 @@ we can think of it as a very powerful calculator.</p>
|
|||
|
||||
<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>>>></tt>' signs act as a prompt
|
||||
border=1 alt="image of hello world program"></p> <p>Those '<tt>>>></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.
|
||||
|
@ -67,7 +69,7 @@ give us its output immediately.
|
|||
<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><img src="simple_commands.gif" border=1 alt="image of command window"></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
|
||||
|
@ -97,11 +99,11 @@ 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><img src="making_new_window.gif" border=1 alt="image of making new window"></p>
|
||||
|
||||
<p>Here's the result of that menu command:</p>
|
||||
|
||||
<p><img src="new_window_made.gif" border=1></p>
|
||||
<p><img src="new_window_made.gif" border=1 alt="image of new window"></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
|
||||
|
@ -114,7 +116,7 @@ to edit windows in other editors such as TextEdit or BBEdit.</p>
|
|||
<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 edit window.</p>
|
||||
<p><img src="entering_in_new_window.gif" border=1></p>
|
||||
<p><img src="entering_in_new_window.gif" border=1 alt="image of entering commands"></p>
|
||||
|
||||
<p>Ok, we're done with copying and pasting.
|
||||
One big thing to notice
|
||||
|
@ -129,22 +131,22 @@ an extra empty print statement so our output ends with a newline.
|
|||
|
||||
<hr><br style="page-break-after: always">
|
||||
|
||||
<p>Let's save the file now. The Save command is located under the <tt>File</tt> menu:
|
||||
<p><img src="saving_edited_file.gif" border=1></p>
|
||||
<p>Let's save the file now. The Save command is located under the <tt>File</tt> menu:</p>
|
||||
<p><img src="saving_edited_file.gif" border=1 alt="image of saving file"></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
|
||||
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><img src="syntax_error.gif" border=1 alt="image of syntax error"></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
|
||||
|
@ -168,7 +170,7 @@ the error occurred. </p>
|
|||
<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>
|
||||
<p><img src="output_window.gif" border=1 alt="image of output window"></p>
|
||||
|
||||
<hr><br style="page-break-after: always">
|
||||
|
||||
|
@ -198,7 +200,7 @@ breakdown of things to see and explore:</p>
|
|||
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
|
||||
<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>
|
||||
|
||||
|
@ -211,7 +213,7 @@ breakdown of things to see and explore:</p>
|
|||
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
|
||||
<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>
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="PackageManager.gif" width="128" height="128" align="top">
|
||||
<img src="PackageManager.gif" width="128" height="128" align="top" alt="">
|
||||
</td>
|
||||
<td>
|
||||
<p>The Python Package Manager helps you installing additional
|
||||
|
@ -35,7 +35,7 @@
|
|||
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 <tt>File->Package Manager</tt> menu
|
||||
as a function of the IDE, through the <tt>File->Package Manager</tt> menu
|
||||
entry. </p>
|
||||
|
||||
<h2>Troubleshooting</h2>
|
||||
|
@ -44,7 +44,7 @@
|
|||
connected to the internet. If you are connected then the problem
|
||||
could be that there is no database (yet?) for your version of Mac OS X.
|
||||
In the standalone Package Manager you can open an alternative database
|
||||
with the <tt>File->Open URL...</tt> command, but you should realize that
|
||||
with the <tt>File->Open URL...</tt> command, but you should realize that
|
||||
you are now on untested ground. </p>
|
||||
|
||||
</td>
|
||||
|
|
|
@ -17,25 +17,25 @@ you to control scriptable applications from your Python program,
|
|||
and with a fairly pythonic interface. This piece of
|
||||
Python:</p>
|
||||
|
||||
<blockquote><tt><pre>
|
||||
<blockquote><pre><tt>
|
||||
import Finder
|
||||
|
||||
f = Finder.Finder()
|
||||
print f.get(f.window(1).name)
|
||||
</pre></tt></blockquote>
|
||||
</tt></pre></blockquote>
|
||||
|
||||
<p>is identical to the following piece of AppleScript:</p>
|
||||
|
||||
<blockquote><tt><pre>
|
||||
<blockquote><pre><tt>
|
||||
tell application "Finder"
|
||||
get name of window 1
|
||||
end tell
|
||||
</pre></tt></blockquote>
|
||||
</tt></pre></blockquote>
|
||||
|
||||
<p>To send AppleEvents to an application you must first create the Python
|
||||
modules interfacing to the terminology of the application (what
|
||||
<tt>Script Editor</tt> calls the "Dictionary"). Use the IDE menu command
|
||||
<tt>File->Generate OSA Suite...</tt> for this. For more control run</p>
|
||||
<tt>File->Generate OSA Suite...</tt> for this. For more control run</p>
|
||||
|
||||
<blockquote><tt>
|
||||
pythonw .../Lib/plat-mac/gensuitemodule.py --help
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="python.gif" width="128" height="128" align="top">
|
||||
<img src="python.gif" width="128" height="128" align="top" alt="">
|
||||
</td>
|
||||
<td>
|
||||
<p>MacPython 2.3 installs a perfectly normal Unix commandline
|
||||
|
@ -26,13 +26,14 @@
|
|||
to the file <tt>.login</tt> in your home directory and restart Terminal:
|
||||
<br>
|
||||
<tt>setenv PATH /usr/local/bin:$PATH</tt>
|
||||
|
||||
</p>
|
||||
|
||||
<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>
|
||||
</p>
|
||||
|
||||
<h2>GUI scripts</h2>
|
||||
|
||||
|
|
Loading…
Reference in New Issue