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.
In more detail
Constructing a shape only creates it in memory; draw(win) makes it visible and undraw removes it. All graphics objects share methods such as setFill, setOutline, setWidth, move and clone. A Rectangle and an Oval are defined by two opposite corners of their bounding box.
Example
c = Circle(Point(100, 100), 30)
c.setFill("red")
c.draw(win)Related terms
- GraphWin — The graphics.py class for a window you can draw in, created as GraphWin(title, width, height).
- draw() — The graphics.py method that makes a shape appear in a window; undraw() removes it again.
- move() — The graphics.py method that shifts a drawn shape by dx pixels across and dy pixels down.
- clone() — Making a separate, independent copy of an object, such as shape.clone() in graphics.py or a list copy with list(a).
- bounding box — The smallest rectangle that encloses a shape or element, given by its position and size or by two opposite corners.
Taught in
- Local Scope And Global Constants — Hands-on Python: Complete Video Course & Book
- A Graphics Introduction — Hands-on Python: Complete Video Course & Book
- Sample Graphics Programs — Hands-on Python: Complete Video Course & Book
- Reading The graphics.py Documentation — Hands-on Python: Complete Video Course & Book
- Graphical Applications With While — Hands-on Python: Complete Video Course & Book