The teachpack provides two sets of functions: one for drawing into a canvas and one for reacting to canvas events.
NOTE: This library is deprecated. Use 2htdp/image (probably in conjunction with 2htdp/universe) instead. You may continue to use the library for solving exercises from How To Design Programs, First Edition but do consider switching to How To Design Programs, Second Edition instead.
DrawColor: (and/c symbol? (one-of/c 'white 'yellow 'red 'blue 'green 'black)) These six colors are definitely provided. If you want other colors, guess! For example, 'orange works, but 'mauve doesn’t. If you apply the function to a symbol that it doesn’t recognize as a color, it raises an error.
The teachpack also provides clear- functions for each draw- function:
(wait-for-mouse-click) → posn?
DrawWorld: For proper interactions, using the teachpack requires that you provide a data definition for DrawWorld . In principle, there are no constraints on this data definition. You can even keep it implicit, even if this violates the Design Recipe.
The following functions allow programs to react to events from the canvas.