Class Window

class tkturtle.Window(x=100, y=100, width=800, height=800)

Instances are GUI windows that support turtle graphics

You should construct a Window object before constructing a Turtle or Pen. You will only need one Window object for the entire assignment.

Constructor: creates a new Window to support turtle graphics

param x:initial x coordinate (default 100)

Precondition: int

param y:initial y coordinate (default 100)

Precondition: int

param width:initial window width (default 800)

Precondition: int

param height:initial window height (default 800)

Precondition: int

All parameters are optional.

Attributes

Window.x

The x coordinate for top left corner of window

Invariant: x must be an int > 0

Window.y

The y coordinate for top left corner of window

Invariant: y must be an int > 0

Window.width

The width of the window in pixels

Invariant: width must be an int > 0

Window.height

The height of the window in pixels

Invariant: height must be an int > 0

Window.title

The title displayed at top of window bar

Invariant: title must be a string

Immutable Attributes

These attributes may be read (e.g. used in an expression), but not altered.

Window.turtles

The list of all turtles attached to this Window

This attribute may not be altered directly

Window.pens

The list of all pens attached to this Window

This attribute may not be altered directly

Methods

Window.clear()

Erase the contents of this Window

All Turtles and Pens are eliminated from the Window. Any attempt to use a previously created Turtle or Pen will fail.

Window.bye()

Closes the graphics Window, deleting all assets