1. Download the latest graphics.py from HERE .
2. Download graphics.py V5 documentation from HERE . (pdf)
3. Copy graphics.py to the same directory as your Python programs.
Note: You may need to convert the file by using the DOS2UNIX program.
Graphics.py is a simple object oriented graphics library. It is designed to make it very easy for novice programmers to experiment with computer graphics in an object oriented fashion. It is written by John Zelle for use with the book "Python Programming: An Introduction to Computer Science" (Franklin, Beedle & Associates).
The package is a wrapper around Tkinter and should run on any platform where Tkinter is available.
There are two kinds of objects in the library. The GraphWin class implements a window where drawing can be done and various GraphicsObjects are provided that can be drawn into a GraphWin.
Graphics.py V5 is an open-source software released under the terms of the GPL (http://www.gnu.org/licenses/gpl.html).
I suggest if you are drawing a plot, create a plot class. It should be independent of the particular problem you are currently working on. This way you can use it over and over again.
Define/create the methods you will need in this class. For example
Start slow. Create a plot class with a few (minimal but important) methods at first. Over time add or modify them as needed.
Here is a simple example. It is a complete program to draw a circle of radius 10 centered in a 100x100 window:
Display the graphic.py version
How would you create a button? You would want to click on it and have some action performed. See the following code for a hint.
graphics.py example program (python)
(YouTube)
Python Graphics Programming (Graphics.py 1): The Basics
(YouTube)
Python Graphics Programming (Graphics.py 2): Primitive shapes
(YouTube)
Python Graphics Programming (Graphics.py 3): Images and text
(YouTube)
Python Graphics Programming (Graphics.py 4): Text boxes
(YouTube)