Functions: There’s a Name for That 171
draw_spiral() function, followed by draw_kaleido(), and we finish
by telling the computer to listen for clicks on the turtle screen
and call draw_kaleido() when click events occur. Now, whenever
the user clicks a location on the drawing window, a spiral will be
drawn there and reflected across the x- and y-axes for a total of
four spirals of the same random shape and size.
The result is a fully interactive version of our spiral kaleido-
scope program that allows the user to control the reflected pattern
by clicking only in parts of the screen where they want spirals
to appear. Figure 7-8 shows a sample run of the program with
reflected patterns made of spirals.
Figure 7-8: With our interactive kaleidoscope program, you
can create any reflected pattern you wish!
Try your own patterns (like your first initial!) and take a
screenshot of your results (in Windows, hold down the alt and
print screen keys to copy the turtle window and then paste into
Word or your favorite drawing program; on a Mac, press and hold
the command [], shift, and 4 keys, then press the spacebar, and
then click the turtle drawing window to save a copy of the pic-
ture to your desktop as Screenshot
your best screenshots to me at @brysonpayne on Twitter with the
hashtag #kidscodebook, and I’ll do my best to respond!