Mercurial > cpython-lru_cache-weakref
annotate Doc/mac/using.tex @ 25838:8540887bcec6 2.2
Backport of 2.183:
Fix memory leak in add_subclass() found by NealN with valgrind.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Fri, 18 Oct 2002 13:42:21 +0000 |
| parents | ca418a5fa471 |
| children | 41e0361a2191 |
| rev | line source |
|---|---|
|
15229
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
1 \chapter{Using Python on the Macintosh \label{using}} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
2 \sectionauthor{Bob Savage}{bobsavage@mac.com} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
3 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
4 Using Python on the Macintosh can seem like something completely |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
5 different than using it on a \UNIX-like or Windows system. Most of the |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
6 Python documentation, both the ``official'' documentation and |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
7 published books, describe only how Python is used on these systems, |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
8 causing confusion for the new user of MacPython. This chapter gives a |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
9 brief introduction to the specifics of using Python on a Macintosh. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
10 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
11 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
12 \section{Getting and Installing MacPython \label{getting}} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
13 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
14 The most recent release version as well as possible newer experimental |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
15 versions are best found at the MacPython page maintained by Jack |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
16 Jansen: \url{http://www.cwi.nl/~jack/macpython.html}. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
17 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
18 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
19 Please refer to the \file{README} included with your distribution for |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
20 the most up-to-date instructions. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
21 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
22 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
23 \section{Entering the interactive Interpreter |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
24 \label{interpreter}} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
25 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
26 The interactive interpreter that you will see used in Python |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
27 documentation is started by double-clicking the |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
28 \program{PythonInterpreter} icon, which looks like a 16-ton weight |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
29 falling. You should see the version information and the |
|
17500
5e99a1d0ea4d
Work around the conversion of ">>" and "<<" to guillemets. Reported by Ping.
Fred Drake <fdrake@acm.org>
parents:
15230
diff
changeset
|
30 \samp{>\code{>}>~} prompt. Use it exactly as described in the |
|
5e99a1d0ea4d
Work around the conversion of ">>" and "<<" to guillemets. Reported by Ping.
Fred Drake <fdrake@acm.org>
parents:
15230
diff
changeset
|
31 standard documentation. |
|
15229
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
32 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
33 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
34 \section{How to run a Python script} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
35 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
36 There are several ways to run an existing Python script; two common |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
37 ways to run a Python script are ``drag and drop'' and ``double |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
38 clicking''. Other ways include running it from within the IDE (see |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
39 Section \ref{IDE}), or launching via AppleScript. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
40 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
41 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
42 \subsection{Drag and drop} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
43 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
44 One of the easiest ways to launch a Python script is via ``Drag and |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
45 Drop''. This is just like launching a text file in the Finder by |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
46 ``dragging'' it over your word processor's icon and ``dropping'' it |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
47 there. Make sure that you use an icon referring to the |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
48 \program{PythonInterpreter}, not the \program{IDE} or \program{Idle} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
49 icons which have different behaviour which is described below. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
50 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
51 Some things that might have gone wrong: |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
52 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
53 \begin{itemize} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
54 \item |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
55 A window flashes after dropping the script onto the |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
56 \program{PythonInterpreter}, but then disappears. Most likely this is a |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
57 configuration issue; your \program{PythonInterpreter} is setup to exit |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
58 immediately upon completion, but your script assumes that if it prints |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
59 something that text will stick around for a while. To fix this, see |
|
15230
10b3cbdbdfd9
Fix some internal references that I botched.
Fred Drake <fdrake@acm.org>
parents:
15229
diff
changeset
|
60 section \ref{defaults}. |
|
15229
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
61 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
62 \item |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
63 After dropping the script onto the \program{PythonInterpreter}, a |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
64 window appeared which said: ``File contains \code{\e r} characters |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
65 (incorrect line endings?)''. That script probably originated on a |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
66 \UNIX{} or Windows machine. You will need to change the line endings |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
67 to the standard Mac usage. One way to do this is to open the file in |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
68 \program{BBedit} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
69 (\url{http://www.barebones.com/products/bbedit_lite.html}) which can |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
70 easily change the line endings between Mac, DOS, and \UNIX\ styles. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
71 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
72 \item |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
73 When you waved the script icon over the \program{PythonInterpreter}, |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
74 the \program{PythonInterpreter} icon did not hilight. Most likely the |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
75 Creator code and document type is unset (or set incorrectly) -- this |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
76 often happens when a file originates on a non-Mac computer. See |
|
15230
10b3cbdbdfd9
Fix some internal references that I botched.
Fred Drake <fdrake@acm.org>
parents:
15229
diff
changeset
|
77 section \ref{creator-code} for more details. |
|
15229
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
78 \end{itemize} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
79 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
80 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
81 \subsection{Set Creator and Double Click \label{creator-code}} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
82 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
83 If the script that you want to launch has the appropriate Creator Code |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
84 and File Type you can simply double-click on the script to launch it. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
85 To be ``double-clickable'' a file needs to be of type \samp{TEXT}, |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
86 with a creator code of \samp{Pyth}. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
87 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
88 Setting the creator code and filetype can be done with the IDE (see |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
89 sections \ref{IDEwrite} and \ref{IDEapplet}), with an editor with a |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
90 Python mode (\program{BBEdit}) -- see section |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
91 \ref{scripting-with-BBedit}, or with assorted other Mac utilities, but |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
92 a script (\file{fixfiletypes.py}) has been included in the MacPython |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
93 distribution, making it possible to set the proper Type and Creator |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
94 Codes with Python. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
95 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
96 The \file{fixfiletypes.py} script will change the file type and |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
97 creator codes for the indicated directory. To use |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
98 \file{fixfiletypes.py}: |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
99 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
100 \begin{enumerate} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
101 \item |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
102 Locate it in the \file{scripts} folder of the \file{Mac} folder of the |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
103 MacPython distribution. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
104 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
105 \item |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
106 Put all of the scripts that you want to fix in a folder with nothing |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
107 else in it. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
108 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
109 \item |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
110 Double-click on the \file{fixfiletypes.py} icon. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
111 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
112 \item |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
113 Navigate into the folder of files you want to fix, and press the |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
114 ``Select current folder'' button. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
115 \end{enumerate} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
116 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
117 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
118 \section{Simulating command line arguments |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
119 \label{argv}} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
120 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
121 There are two ways to simulate command-line arguments with MacPython. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
122 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
123 \begin{enumerate} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
124 \item via Interpreter options |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
125 \begin{itemize} % nestable? I hope so! |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
126 \item Hold the option-key down when launching your script. This will |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
127 bring up a dialog box of Python Interpreter options. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
128 \item Click ``Set \UNIX-style command line..'' button. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
129 \item Type the arguments into the ``Argument'' field. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
130 \item Click ``OK'' |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
131 \item Click ``Run''. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
132 \end{itemize} % end |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
133 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
134 \item via drag and drop |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
135 If you save the script as an applet (see Section \ref{IDEapplet}), you |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
136 can also simulate some command-line arguments via |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
137 ``Drag-and-Drop''. In this case, the names of the files that were |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
138 dropped onto the applet will be appended to \code{sys.argv}, so that |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
139 it will appear to the script as though they had been typed on a |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
140 command line. As on \UNIX\ systems, the first item in \code{sys.srgv} is |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
141 the path to the applet, and the rest are the files dropped on the |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
142 applet. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
143 \end{enumerate} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
144 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
145 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
146 \section{Creating a Python script} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
147 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
148 Since Python scripts are simply text files, they can be created in any |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
149 way that text files can be created, but some special tools also exist |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
150 with extra features. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
151 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
152 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
153 \subsection{In an editor} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
154 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
155 You can create a text file with any word processing program such as |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
156 \program{MSWord} or \program{AppleWorks} but you need to make sure |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
157 that the file is saved as ``\ASCII'' or ``plain text''. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
158 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
159 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
160 \subsubsection{Editors with Python modes} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
161 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
162 Several text editors have additional features that add functionality |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
163 when you are creating a Python script. These can include coloring |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
164 Python keywords to make your code easier to read, module browsing, or |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
165 a built-in debugger. These include \program{Alpha}, \program{Pepper}, |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
166 and \program{BBedit}, and the MacPython IDE (Section \ref{IDE}). |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
167 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
168 %\subsubsection{Alpha} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
169 % **NEED INFO HERE** |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
170 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
171 \subsubsection{BBedit \label{scripting-with-BBedit}} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
172 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
173 If you use \program{BBEdit} to create your scripts you will want to tell it about the Python creator code so that |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
174 you can simply double click on the saved file to launch it. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
175 \begin{itemize} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
176 \item Launch \program{BBEdit}. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
177 \item Select ``Preferences'' from the ``Edit'' menu. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
178 \item Select ``File Types'' from the scrolling list. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
179 \item click on the ``Add...'' button and navigate to |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
180 \program{PythonInterpreter} in the main directory of the |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
181 MacPython distribution; click ``open''. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
182 \item Click on the ``Save'' button in the Preferences panel. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
183 \end{itemize} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
184 % Are there additional BBedit Python-specific features? I'm not aware of any. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
185 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
186 %\subsubsection{IDE} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
187 %You can use the \program{Python IDE} supplied in the MacPython Distribution to create longer Python scripts |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
188 %-- see Section \ref{IDEwrite} for details. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
189 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
190 %\subsubsection{IDLE} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
191 %Idle is an IDE for Python that was written in Python, using TKInter. You should be able to use it on a Mac by following |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
192 %the standard documentation, but see Section \ref{TKInter} for guidance on using TKInter with MacPython. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
193 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
194 %\subsubsection{Pepper} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
195 % **NEED INFO HERE** |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
196 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
197 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
198 \section{The IDE\label{IDE}} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
199 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
200 The \program{Python IDE} (Integrated Development Environment) is a |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
201 separate application that acts as a text editor for your Python code, |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
202 a class browser, a graphical debugger, and more. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
203 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
204 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
205 \subsection{Using the ``Python Interactive'' window} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
206 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
207 Use this window like you would the \program{PythonInterpreter}, except |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
208 that you cannot use the ``Drag and drop'' method above. Instead, |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
209 dropping a script onto the \program{Python IDE} icon will open the |
|
20821
ca418a5fa471
Correct misspelling of "separate" in two places.
Fred Drake <fdrake@acm.org>
parents:
17500
diff
changeset
|
210 file in a separate script window (which you can then execute manually |
|
15229
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
211 -- see section \ref{IDEexecution}). |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
212 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
213 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
214 \subsection{Writing a Python Script \label{IDEwrite}} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
215 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
216 In addition to using the \program{Python IDE} interactively, you can |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
217 also type out a complete Python program, saving it incrementally, and |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
218 execute it or smaller selections of it. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
219 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
220 You can create a new script, open a previously saved script, and save |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
221 your currently open script by selecting the appropriate item in the |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
222 ``File'' menu. Dropping a Python script onto the |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
223 \program{Python IDE} will open it for editting. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
224 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
225 If you try to open a script with the \program{Python IDE} but either |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
226 can't locate it from the ``Open'' dialog box, or you get an error |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
227 message like ``Can't open file of type ...'' see section |
|
15230
10b3cbdbdfd9
Fix some internal references that I botched.
Fred Drake <fdrake@acm.org>
parents:
15229
diff
changeset
|
228 \ref{creator-code}. |
|
15229
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
229 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
230 When the \program{Python IDE} saves a script, it uses the creator code |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
231 settings which are available by clicking on the small black triangle |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
232 on the top right of the document window, and selecting ``save |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
233 options''. The default is to save the file with the \program{Python |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
234 IDE} as the creator, this means that you can open the file for editing |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
235 by simply double-clicking on its icon. You might want to change this |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
236 behaviour so that it will be opened by the |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
237 \program{PythonInterpreter}, and run. To do this simply choose |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
238 ``Python Interpreter'' from the ``save options''. Note that these |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
239 options are associated with the \emph{file} not the application. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
240 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
241 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
242 \subsection{Executing a script from within the IDE |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
243 \label{IDEexecution}} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
244 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
245 You can run the script in the frontmost window of the \program{Python |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
246 IDE} by hitting the run all button. You should be aware, however that |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
247 if you use the Python convention \samp{if __name__ == "__main__":} the |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
248 script will \emph{not} be ``__main__'' by default. To get that |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
249 behaviour you must select the ``Run as __main__'' option from the |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
250 small black triangle on the top right of the document window. Note |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
251 that this option is associated with the \emph{file} not the |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
252 application. It \emph{will} stay active after a save, however; to shut |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
253 this feature off simply select it again. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
254 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
255 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
256 \subsection{``Save as'' versus ``Save as Applet'' |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
257 \label{IDEapplet}} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
258 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
259 When you are done writing your Python script you have the option of |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
260 saving it as an ``applet'' (by selecting ``Save as applet'' from the |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
261 ``File'' menu). This has a significant advantage in that you can drop |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
262 files or folders onto it, to pass them to the applet the way |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
263 command-line users would type them onto the command-line to pass them |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
264 as arguments to the script. However, you should make sure to save the |
|
20821
ca418a5fa471
Correct misspelling of "separate" in two places.
Fred Drake <fdrake@acm.org>
parents:
17500
diff
changeset
|
265 applet as a separate file, do not overwrite the script you are |
|
15229
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
266 writing, because you will not be able to edit it again. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
267 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
268 Accessing the items passed to the applet via ``drag-and-drop'' is done |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
269 using the standard \member{sys.argv} mechanism. See the general |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
270 documentation for more |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
271 % need to link to the appropriate place in non-Mac docs |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
272 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
273 Note that saving a script as an applet will not make it runnable on a |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
274 system without a Python installation. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
275 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
276 %\subsection{Debugger} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
277 % **NEED INFO HERE** |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
278 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
279 %\subsection{Module Browser} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
280 % **NEED INFO HERE** |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
281 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
282 %\subsection{Profiler} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
283 % **NEED INFO HERE** |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
284 % end IDE |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
285 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
286 %\subsection{The ``Scripts'' menu} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
287 % **NEED INFO HERE** |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
288 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
289 \section{Configuration \label{configuration}} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
290 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
291 The MacPython distribution comes with \program{EditPythonPrefs}, an |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
292 applet which will help you to customize the MacPython environment for |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
293 your working habits. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
294 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
295 \subsection{EditPythonPrefs\label{EditPythonPrefs}} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
296 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
297 \program{EditPythonPrefs} gives you the capability to configure Python |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
298 to behave the way you want it to. There are two ways to use |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
299 \program{EditPythonPrefs}, you can use it to set the preferences in |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
300 general, or you can drop a particular Python engine onto it to |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
301 customize only that version. The latter can be handy if, for example, |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
302 you want to have a second copy of the \program{PythonInterpreter} that |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
303 keeps the output window open on a normal exit even though you prefer |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
304 to normally not work that way. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
305 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
306 To change the default preferences, simply double-click on |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
307 \program{EditPythonPrefs}. To change the preferences only for one copy |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
308 of the Interpreter, drop the icon for that copy onto |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
309 \program{EditPythonPrefs}. You can also use \program{EditPythonPrefs} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
310 in this fashion to set the preferences of the \program{Python IDE} and |
|
15230
10b3cbdbdfd9
Fix some internal references that I botched.
Fred Drake <fdrake@acm.org>
parents:
15229
diff
changeset
|
311 any applets you create -- see section %s \ref{BuildApplet} and |
|
15229
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
312 \ref{IDEapplet}. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
313 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
314 \subsection{Adding modules to the Module Search Path |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
315 \label{search-path}} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
316 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
317 When executing an \keyword{import} statement, Python looks for modules |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
318 in places defined by the \member{sys.path} To edit the |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
319 \member{sys.path} on a Mac, launch \program{EditPythonPrefs}, and |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
320 enter them into the largish field at the top (one per line). |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
321 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
322 Since MacPython defines a main Python directory, the easiest thing is |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
323 to add folders to search within the main Python directory. To add a |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
324 folder of scripts that you created called ``My Folder'' located in the |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
325 main Python Folder, enter \samp{\$(PYTHON):My Folder} onto a new line. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
326 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
327 To add the Desktop under OS 9 or below, add |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
328 \samp{StartupDriveName:Desktop Folder} on a new line. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
329 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
330 \subsection{Default startup options \label{defaults}} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
331 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
332 % I'm assuming that there exists some other documentation on the |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
333 % rest of the options so I only go over a couple here. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
334 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
335 The ``Default startup options...'' button in the |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
336 \program{EditPythonPrefs} dialog box gives you many options including |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
337 the ability to keep the ``Output'' window open after the script |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
338 terminates, and the ability to enter interactive mode after the |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
339 termination of the run script. The latter can be very helpful if you |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
340 want to examine the objects that were created during your script. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
341 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
342 %\section{Nifty Tools} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
343 %There are many other tools included with the MacPython |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
344 %distribution. In addition to those discussed here, make |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
345 %sure to check the \file{Mac} directory. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
346 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
347 %\subsection{BuildApplet \label{BuildApplet}} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
348 % **NEED INFO HERE** |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
349 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
350 %\subsection{BuildApplication} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
351 % **NEED INFO HERE** |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
352 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
353 %\section{TKInter on the Mac \label{TKInter}} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
354 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
355 %TKinter is installed by default with the MacPython distribution, but |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
356 %you may need to add the \file{lib-tk} folder to the Python Path (see |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
357 %section \ref{search-path}). Also, it is important that you do not |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
358 %try to launch Tk from within the \program{Python IDE} because the two |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
359 %event loops will collide -- always run a script which uses Tkinter |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
360 %with the \program{PythonInterpreter} instead -- see section |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
361 %\ref{interpreter}. |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
362 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
363 %\section{CGI on the Mac with Python \label{CGI}} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
364 %**NEED INFO HERE** |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
365 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
366 \section{Mac OS X} |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
367 |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
368 At the time of this writing Mac OS X had just been released as a |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
369 Public Beta. Efforts are under way to bring MacPython to Mac OS X. The |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
370 MacPython release \version{1.5.2c1} runs quite well within the |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
371 ``Classic'' environment. A ``Carbon'' port of the MacPython code is |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
372 being prepared for release, and several people have made a command |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
373 line version available to the ``Darwin'' layer (which is accessible |
|
bd88df20da2f
Chapter on how to use MacPython, by Bob Savage <bobsavage@mac.com>.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
374 via Terminal.app). |
