I'm using DrRacket 6.4, and I want to show images using the 2htdp/image library. If the user types in "start", an image will be printed. However, I can't get images to show while trying to show them from inside a loop; it seems that images only display when the procedure has "returned".
This works:
(define (showimg p) (place-image
(triangle 32 "solid" "red")
24 24
p))
;; prints an image
(define (a p)
(define command (read-line))
(cond [(string=? command "start") (showimg p)]))
(a (empty-scene 160 90))
This does not:
;; should print an image indefinitely
(define (a p)
(define command (read-line))
(cond [(string=? command "start") (showimg p)])
(a (empty-scene 160 90))
)
(a (empty-scene 160 90))
Is there any way I can get this to work using recursion (as it currently is), or if needed, some other way to get user input continuously, while showing images?
Thank you.