Class Window

cornell.Window(x=100, y=100, width=800, height=800, scale=1)

Constructor: creates a new Window to support turtle graphics

Parameter:
  • x (int >= 0) – initial x coordinate (default 100)
  • y (int >= 0) – initial y coordinate (default 100)
  • width (int > 0) – initial window width (default 800)
  • height (int > 0) – initial window height (default 800)
  • scale (float > 0) – initial window scale (INGORED)

Attributes

x

The x coordinate for top left corner of window

invariant: x must be an int >= 0

y

The y coordinate for top left corner of window

invariant: y must be an int >= 0

width

The width of the window in pixels

invariant: width must be an int > 0

height

The height of the window in pixels

invariant: height must be an int > 0

title

The title displayed at top of window bar

invariant: title must be a str

Immutable Attributes

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

turtles

The tuple of all turtles attached to this Window

This attribute may not be altered directly

pens

The tuple of all pens attached to this Window

This attribute may not be altered directly

Methods

clear()

Erases 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.

bye()

Closes the graphics Window, deleting all assets.