Working with Files |
File Types Since your programs will be written in Jython, and Jython is just a Java version of the language Python, your program files should be saved with the Python extension .py, as in: MyFile1.py JES will allow you to open any file that is written as plain text. That means that if you wanted to, you could use standard text editors such as NotePad on Windows, or TextEdit on Mac to write programs and then open them in JES later on. You should never use word processors like Word to edit programs. Word adds lots of extra information to your files, which can cause your program not to run when you test it out in JES. |
jump
to top
|
Creating New Files
To create a new file in JES, select "New Program" from the file menu (or press Ctrl-n). In JES, only one file may be open at any time. That means that if you create a new file, JES simply replaces any file that was already open with a new, blank, unnamed file. JES will ask you if you would like to save changes in the open file, pressing yes will save the file, pressing no will simply abandon any changes to that file, and pressing cancel will abort the New Program command, allowing you to continue work on your current file. |
jump
to top
|
Opening Files
To open a file, simply select "Open Program" from the file menu (or press Ctrl-o); a file selection dialog box will appear. You may not open more than one file at one time. When you open a file, JES simply replaces any file that was already open with the new file. JES will ask you if you would like to save changes in the open file, pressing yes will save the file, pressing no will simply abandon any changes to that file, and pressing cancel will abort the Open Program command, allowing you to continue work on your current file. |
jump
to top
|
Saving Files
Save files in JES by selecting "Save Program" from the file menu (or press Ctrl-s). Of course, the first time you save a file you will be prompted for a unique name for that file. As in most word processors you have used, JES allows you to save a file with a new name by selecting "Save Program As..." from the File menu (or press Ctrl-Shift-s). By default, JES saves backup files in the same menu when you save. These backup files have the extension .pybak on them. These files are text just like your .py files. You can use these backup files if you accidentally delete your original work. Also, you can turn off this option in the Options Menu under Edit. Save early and save often! |
jump
to top
|
Printing Files
Print files in JES by selecting "Print" from the file menu (or press Ctrl-p). |
jump
to top
|
Loading Files
To load a file, click on the "Load Program" button between the program and command areas of JES. Loading files is something you may not have encountered before. When you load a file, it causes the program that you wrote in the program area to become available in the command area. Once it is loaded, you can use the command area to call your program and test it out. Remember that your file must be saved before you load it. If you try to load it without saving first, it will not load any changes that you might have made since the last load. |
jump
to top
|