[MWForum]setbg and patterned backgrounds

Wendy Petti mwforum@lists.mathcats.com
Wed, 19 Feb 2003 12:00:32 -0600


To undo a "setbg" command, just enter the command

setbg 0

(or use whatever color number you prefer).

This will not erase any graphics stamped on top of the background, but it will restore the background to white.

As for how to create a patterned background, this can become a little programming challenge for your students.  For instance, set the turtle's shape to the desired shape for the pattern and position it in the top left corner of the page, then write a procedure something like this (adjusting the numbers depending on the turtle's size and your page size):

to pattern
seth 90
repeat 9 [repeat 15 [fd 40 stamp]
          bk 15 * 40
          rt 90 fd 40 lt 90]
seth 90
end

I bet your students can program a rainbow, too, with a series of half-circles of increasing size.  Set the turtle to a wide pen size, such as

setpensize 60

It will take some experimenting to get it right, but that is a good part of the fun.

If you wish to stamp other graphics on top of the background pattern and then be able to erase those added graphics, be sure to freeze the background pattern before you continue:

freezebg

Then "clean" or "cg" will erase the graphics added on top of this background without erasing the background itself.

Wendy Petti