turtles: better error message and improve docs

When uninitialized, turtles was giving a poor internal error.
Now it should tell the user to initialize. Also, added a note
in the docs about initialization.
This commit is contained in:
Asumu Takikawa 2012-03-03 14:15:22 -05:00
parent 06e94d510a
commit 6edf9c16d4
2 changed files with 7 additions and 2 deletions

View File

@ -5,6 +5,9 @@
@defmodule[graphics/turtles]
To use any of the turtle drawing functions, you first need to
initialize the turtles by calling @racket[(turtles #t)].
@defproc*[([(turtles [on? any/c]) void?]
[(turtles) void?])]{
@ -126,7 +129,8 @@ The fern functions below demonstrate more advanced use of
@defmodule[graphics/turtle-examples]
The @racketmodname[graphics/turtle-examples] library's source is meant
to be read, but it also exports the following examples.
to be read, but it also exports the following examples. To display these
examples, first initialize the turtle window with @racket[(turtles #t)].
@defproc[(regular-poly [sides exact-nonnegative-integer?] [radius real?])
void?]{

View File

@ -220,7 +220,8 @@
(clear-window))
(define (update-icon)
(send turtles:window refresh))
(when turtles:window
(send turtles:window refresh)))
(define (home)
(set! turtles-cache empty-cache)