[plt-scheme] A question about PLT Graphics Toolkit

From: Ziboon (ziboon at gmail.com)
Date: Thu Mar 5 05:38:01 EST 2009

hi allI am beginning in scheme language: I don't understant this:

 #lang scheme/gui
 (define f (new frame%
              (label "test") ))

(define c (new canvas%
               (parent f)
               (min-width 200)
               (paint-callback (λ (canvas dc)
                                 (send dc clear)))))

 (define dc (send c get-dc))

(send dc set-background (make-object color% "red"))

(send dc draw-rectangle 0 0 50 50)

(send f show #t )*


Why set-background work :  I see my canvas red; but draw-rectangle doesn't
work  there are no rectangle in my canvas.

I try to  delete set-background line but I don't see my rectangle.

so I know if I put  *(send dc draw-rectangle 0 0 50 50)    *in
paint-callback  it will work .

But i want draw a rectangle not directly in my canvas class.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20090305/287575bb/attachment.html>

Posted on the users mailing list.