Skip to content

Instantly share code, notes, and snippets.

@dyoo
Last active December 16, 2015 23:21
Show Gist options
  • Save dyoo/5513185 to your computer and use it in GitHub Desktop.
Save dyoo/5513185 to your computer and use it in GitHub Desktop.
A simple canvas example
#lang racket/gui
(define program-state 0)
(define f (new frame% [label "Example program"]))
(define c (new canvas%
[parent f]
[min-width 500]
[min-height 500]
[paint-callback
(lambda (_ dc)
(send dc draw-ellipse program-state program-state 50 50))]))
(define b (new button%
[parent f]
[label "press me"]
[callback (lambda (_ evt)
(printf "Pressed\n")
(set! program-state (+ program-state 10))
(send c refresh))]))
(send f show #t)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment