[plt-scheme] newbie - plotting points

From: andrew cooke (andrew at acooke.org)
Date: Wed Jan 18 12:20:20 EST 2006


I've not programmed much in Lisp or Scheme, and have done nothing at all
for quite some years, so this may be a very stupid question...

I'm trying to adapt the example at
http://schemecookbook.org/Cookbook/GUIHelloWorld to plot a point on an
empty canvas.  I'm using PLT scheme, just downloaded, with the "Pretty
Big" language.

My code, which runs fine, but displays no dot, is below.  Why don't I see
a red dot near one of the corners of the screen?  (It doesn't work with
the deafult pen, either).


(require (lib "mred.ss" "mred")
         (lib "class.ss" "mzlib"))

(define the-frame
  (new frame%
       (label "Hello!")
       (width 400)
       (height 400)))

(define the-canvas
  (new canvas%
       (parent the-frame)))

(define the-pen
  (let ((red (make-object color% 255 0 0)))
    (make-object pen% red 5 'solid)))

(define the-dot
  (let ((dc (send the-canvas get-dc )))
    (send dc set-pen the-pen)
    (send dc draw-point 5 5)))

(send the-frame show #t)

` __ _ __ ___  ___| |_____   personal site: http://www.acooke.org/andrew
 / _` / _/ _ \/ _ \ / / -_)  blog: http://www.acooke.org/cute
 \__,_\__\___/\___/_\_\___|  aim: acookeorg; skype: andrew-cooke

Posted on the users mailing list.