Last active
December 16, 2015 23:21
-
-
Save dyoo/5513185 to your computer and use it in GitHub Desktop.
A simple canvas example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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