Working with setup and screensize

You don’t need to use the setup and screensize functions, and can instead design your drawing using the rough size of 700×700 pixels (i.e. coordinates from -350 to 350). However, if you want to explicitly control the size of the window and canvas you will likely want to use both setup and screensize.

The Turtle “screen” actually consists of window with an underlying canvas on which we actually draw. The canvas can be larger than the window. You can use the setup function to set the window size and screensize to set the size of the underlying canvas. For example

setup(700, 700)
screensize(700, 700)

to create a 700×700 pixel canvas. Note that the full edges of the canvas may not be visible. And the possible size of the window may be limited by your display.

As a style note, the screen size is an excellent candidate for a constant, e.g.

MIN_COORD=-350
MAX_COORD=350

setup(MAX_COORD-MIN_COORD, MAX_COORD-MIN_COORD)
screensize(MAX_COORD-MIN_COORD, MAX_COORD-MIN_COORD)