How to install the Zelle graphics package

advertisement
How to install the Zelle
graphics package
Zelle’s package
•
•
•
•
•
•
•
•
This is a package written by John M. Zelle for teaching Python graphics
It is available at http://mcsp.wartburg.edu/zelle/python/
The link on that page is graphics.py
Do not left click on this link, right click on it
This gives you a menu – choose “Save Link (or Target) As”
Save the file in a location where you will know where it is, like the Desktop
It’s a small file, will not take long to download
Make sure it is called graphics.py when you save it
The place to put graphics.py on a PC
• The best place to put it is within the same file structure as the Python
executable
• On a Windows machine, assuming you do have Python installed, on
the C drive, the location the file should be is
C:\Python3X\Lib\site-packages\graphics.py
where the 3X is the version of Python you have installed
• The other place you can put the file is in the same folder as your source (.py)
file. This is not the best place because it means if you have several folders for
several programs, you would need a copy of the graphics.py file in each of them.
• Clearly you do not want to name YOUR SOURCE FILE graphics.py!
The place to put graphics.py on a Mac
• The best place to put it is within the same file structure as the Python
executable
• On a Macintosh, the most typical place is \bin\local\user\python\ but you will
have to check. You need to find the location of the python executable. This can
be done from a Terminal window with the command “type –a python”. It will
return a path. Put the graphics.py file in that location.
• The other place you can put the file is in the same folder as your source (.py)
file. This is not the best place because it means if you have several folders for
several programs, you would need a copy of the graphics.py file in each of them.
• Clearly you do not want to name YOUR SOURCE FILE graphics.py!
To verify it is installed
• From the Shell window in your favorite IDE, give the “import
graphics” command
• If graphics.py is found, it will just come back with another prompt
• If graphics.py is not found, you will get an error message
• Note: if you put graphics.py in the same folder as your source code,
make sure you have saved the source code at least once, otherwise
the IDE will not know where to look for graphics.py
• Note: it does not matter which IDE you are using, IDLE or WingIDE.
The location of the graphics.py file is the same.
Download