graphics.py
A small teaching library by John Zelle, built on tkinter, for drawing shapes, text and entry boxes in a window.
In more detail
It is not part of the standard library: the file graphics.py must sit in the same folder as your program, or elsewhere on the module search path. Every program follows one shape: create a GraphWin, create shapes, draw them, wait for a click, close the window.
Example
from graphics import *
win = GraphWin("Demo", 300, 200)Related terms
- GraphWin — The graphics.py class for a window you can draw in, created as GraphWin(title, width, height).
- graphics object — A shape in graphics.py, such as a Point, Line, Circle, Rectangle, Oval, Polygon or Text, which you construct and then draw in a window.
- tkinter — The standard library module that lets Python programs create windows and graphics using Tk.
Taught in
- Installing Python On Windows — Hands-on Python: Complete Video Course & Book
- First Run, And Fixing A Broken Install — Hands-on Python: Complete Video Course & Book
- A Graphics Introduction — Hands-on Python: Complete Video Course & Book
- Reading The graphics.py Documentation — Hands-on Python: Complete Video Course & Book
- Mutable Objects And Aliases — Hands-on Python: Complete Video Course & Book