From e2ff8be761a5c4958572d2aa6c9ee247e3c90c85 Mon Sep 17 00:00:00 2001 From: Jack Jansen Date: Wed, 2 Jul 2003 09:20:09 +0000 Subject: Moved the IDE tutorial to a directory with a shorter name. The long name was giving problems with some tar implementations. --- Mac/OSX/Makefile | 2 +- .../English.lproj/Documentation/ide/IDE.gif | Bin 0 -> 10249 bytes .../Documentation/ide/entering_in_new_window.gif | Bin 0 -> 15578 bytes .../Documentation/ide/hello_world.gif | Bin 0 -> 15681 bytes .../English.lproj/Documentation/ide/index.html | 222 +++++++++++++++++++++ .../Documentation/ide/loading_ide.gif | Bin 0 -> 50595 bytes .../Documentation/ide/making_new_window.gif | Bin 0 -> 25978 bytes .../Documentation/ide/new_ide_window.gif | Bin 0 -> 20606 bytes .../Documentation/ide/new_window_made.gif | Bin 0 -> 21808 bytes .../Documentation/ide/output_window.gif | Bin 0 -> 37660 bytes .../Documentation/ide/saving_edited_file.gif | Bin 0 -> 26559 bytes .../Documentation/ide/simple_commands.gif | Bin 0 -> 14134 bytes .../Documentation/ide/syntax_error.gif | Bin 0 -> 12850 bytes .../English.lproj/Documentation/index.html | 2 +- .../English.lproj/Documentation/intro.html | 2 +- .../Documentation/macpython_ide_tutorial/IDE.gif | Bin 10249 -> 0 bytes .../entering_in_new_window.gif | Bin 15578 -> 0 bytes .../macpython_ide_tutorial/hello_world.gif | Bin 15681 -> 0 bytes .../macpython_ide_tutorial/index.html | 222 --------------------- .../macpython_ide_tutorial/loading_ide.gif | Bin 50595 -> 0 bytes .../macpython_ide_tutorial/making_new_window.gif | Bin 25978 -> 0 bytes .../macpython_ide_tutorial/new_ide_window.gif | Bin 20606 -> 0 bytes .../macpython_ide_tutorial/new_window_made.gif | Bin 21808 -> 0 bytes .../macpython_ide_tutorial/output_window.gif | Bin 37660 -> 0 bytes .../macpython_ide_tutorial/saving_edited_file.gif | Bin 26559 -> 0 bytes .../macpython_ide_tutorial/simple_commands.gif | Bin 14134 -> 0 bytes .../macpython_ide_tutorial/syntax_error.gif | Bin 12850 -> 0 bytes 27 files changed, 225 insertions(+), 225 deletions(-) create mode 100644 Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/IDE.gif create mode 100644 Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/entering_in_new_window.gif create mode 100644 Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/hello_world.gif create mode 100644 Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/index.html create mode 100644 Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/loading_ide.gif create mode 100644 Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/making_new_window.gif create mode 100644 Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/new_ide_window.gif create mode 100644 Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/new_window_made.gif create mode 100644 Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/output_window.gif create mode 100644 Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/saving_edited_file.gif create mode 100644 Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/simple_commands.gif create mode 100644 Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/syntax_error.gif delete mode 100644 Mac/OSXResources/app/Resources/English.lproj/Documentation/macpython_ide_tutorial/IDE.gif delete mode 100644 Mac/OSXResources/app/Resources/English.lproj/Documentation/macpython_ide_tutorial/entering_in_new_window.gif delete mode 100644 Mac/OSXResources/app/Resources/English.lproj/Documentation/macpython_ide_tutorial/hello_world.gif delete mode 100644 Mac/OSXResources/app/Resources/English.lproj/Documentation/macpython_ide_tutorial/index.html delete mode 100644 Mac/OSXResources/app/Resources/English.lproj/Documentation/macpython_ide_tutorial/loading_ide.gif delete mode 100644 Mac/OSXResources/app/Resources/English.lproj/Documentation/macpython_ide_tutorial/making_new_window.gif delete mode 100644 Mac/OSXResources/app/Resources/English.lproj/Documentation/macpython_ide_tutorial/new_ide_window.gif delete mode 100644 Mac/OSXResources/app/Resources/English.lproj/Documentation/macpython_ide_tutorial/new_window_made.gif delete mode 100644 Mac/OSXResources/app/Resources/English.lproj/Documentation/macpython_ide_tutorial/output_window.gif delete mode 100644 Mac/OSXResources/app/Resources/English.lproj/Documentation/macpython_ide_tutorial/saving_edited_file.gif delete mode 100644 Mac/OSXResources/app/Resources/English.lproj/Documentation/macpython_ide_tutorial/simple_commands.gif delete mode 100644 Mac/OSXResources/app/Resources/English.lproj/Documentation/macpython_ide_tutorial/syntax_error.gif diff --git a/Mac/OSX/Makefile b/Mac/OSX/Makefile index 5720069..3ba4976 100644 --- a/Mac/OSX/Makefile +++ b/Mac/OSX/Makefile @@ -46,7 +46,7 @@ APPTEMPLATE=$(srcdir)/Mac/OSXResources/app APPSUBDIRS=MacOS Resources Resources/English.lproj \ Resources/English.lproj/Documentation \ Resources/English.lproj/Documentation/doc \ - Resources/English.lproj/Documentation/macpython_ide_tutorial + Resources/English.lproj/Documentation/ide DOCDIR=$(srcdir)/Mac/OSXResources/app/Resources/English.lproj/Documentation DOCINDEX=$(DOCDIR)/"Documentation idx" CACHERSRC=$(srcdir)/Mac/scripts/cachersrc.py diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/IDE.gif b/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/IDE.gif new file mode 100644 index 0000000..da9325d Binary files /dev/null and b/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/IDE.gif differ diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/entering_in_new_window.gif b/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/entering_in_new_window.gif new file mode 100644 index 0000000..baa400e Binary files /dev/null and b/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/entering_in_new_window.gif differ diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/hello_world.gif b/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/hello_world.gif new file mode 100644 index 0000000..c7390af Binary files /dev/null and b/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/hello_world.gif differ diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/index.html b/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/index.html new file mode 100644 index 0000000..a169f5e --- /dev/null +++ b/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/index.html @@ -0,0 +1,222 @@ + + + + One Day of MacPython IDE Toying + + + + +

One Day of MacPython IDE Toying

+ + + + + +
+ + +

This document gives a very basic introduction to the + MacPython Integrated Development Environment (IDE) 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 + "One + Day of IDLE Toying" by Danny Yoo, which you should read if + you want to use the cross-platform IDLE Python development + environment.

+ +
+
+
+ +

Ok, let's assume that we've already installed Python. (If not, we can +visit: http://www.cwi.nl/~jack/macpython.html +or http://python.org +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:

image of IDE icon

+ +

+ +

The IDE starts up and shows an interactive window:

+

image of new window

+ +

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 Windows->Python Interactive +menu entry.

+ +

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 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.

+ +

+ +

Let's try something now! As per tradition, let's get Python to say +the immortal words, "Hello World". image of hello world program

Those '>>>' 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. +

+ +

+ +

Ok, this seems pretty simple enough. Let's try a few more +commands. If we look below:

+ +

image of command window

+ +

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.

+ +

If you got to this point, you now know enough to start playing +around with Python! Crack open one of the tutorials from the Python For Beginners web +page, and start exploring with the interpreter. No time limit here. *grin*

+ +

+ +

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?

+ +

The solution is a little subtle: we can't directly save what's in +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.

+ +

Let's try this. First, let's start with a clean slate by opening +up a new window.

+ +

image of making new window

+ +

Here's the result of that menu command:

+ +

image of new window

+ +

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.

+ +

+ +

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.

+

image of entering commands

+ +

Ok, we're done with copying and pasting. +One big thing to notice +is that we're careful to get rid of the ">>>" +prompts because they're 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. +

+ +

+ +

Let's save the file now. The Save command is located under the File menu:

+

image of saving file

+ + +

+ +

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 Python->Run Window. The output will appear in a new +window called Output Window.

+ +

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?

+ +

image of syntax error

+ +

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.

+ +

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 a +quotation mark at the end. Let's add that in now.

+ +

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 showing you where +the error occurred.

+ +

+ +

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:

+

image of output window

+ +

+ +

As we play with Python, we'll find ourselves "switching modes" +between the Interpreter window and the edit 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. Align +your edit and output window such that you can see them at the same time.

+ +

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:

+ + + + diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/loading_ide.gif b/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/loading_ide.gif new file mode 100644 index 0000000..e7cca3d Binary files /dev/null and b/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/loading_ide.gif differ diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/making_new_window.gif b/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/making_new_window.gif new file mode 100644 index 0000000..d2022c8 Binary files /dev/null and b/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/making_new_window.gif differ diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/new_ide_window.gif b/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/new_ide_window.gif new file mode 100644 index 0000000..7268a84 Binary files /dev/null and b/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/new_ide_window.gif differ diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/new_window_made.gif b/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/new_window_made.gif new file mode 100644 index 0000000..dd6cca3 Binary files /dev/null and b/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/new_window_made.gif differ diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/output_window.gif b/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/output_window.gif new file mode 100644 index 0000000..568dcb5 Binary files /dev/null and b/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/output_window.gif differ diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/saving_edited_file.gif b/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/saving_edited_file.gif new file mode 100644 index 0000000..6e5c926 Binary files /dev/null and b/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/saving_edited_file.gif differ diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/simple_commands.gif b/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/simple_commands.gif new file mode 100644 index 0000000..1dba570 Binary files /dev/null and b/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/simple_commands.gif differ diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/syntax_error.gif b/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/syntax_error.gif new file mode 100644 index 0000000..2e95b87 Binary files /dev/null and b/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/syntax_error.gif differ diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/index.html b/Mac/OSXResources/app/Resources/English.lproj/Documentation/index.html index 34e1042..ef12c10 100644 --- a/Mac/OSXResources/app/Resources/English.lproj/Documentation/index.html +++ b/Mac/OSXResources/app/Resources/English.lproj/Documentation/index.html @@ -22,7 +22,7 @@