Hi people,

I am wondering why this segment of code failed to work:

; don't work
#lang racket

(require slideshow racket/class racket/gui/base)

(define my-frame (new frame% [label "my frame"]
                             [width 300] [height 300]
                             [alignment '(center center)] ))

(define my-canvas
      (new canvas% [parent my-frame]
          ))

(define my-dc (send my-canvas get-dc))

(draw-pict (circle 60) my-dc 40 40)


(send my-frame show #t)

While the following codes *do* work:

; do work
#lang racket

(require slideshow racket/class racket/gui/base)

(define my-frame (new frame% [label "my frame"]
                             [width 300] [height 300]
                             [alignment '(center center)] ))

(define my-canvas
      (new canvas% [parent my-frame]
                   [paint-callback (lambda (self dc)
                                  (draw-pict (circle 60) dc 40 40)

                               )]
          ))

(send my-frame show #t)

Is there anyway to avoid using redefining paint-callback to draw one or more
pictures on the canvas, as in the first example?

Thanks in advance for your answer,

Mianlai

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to