Skip to content

Instantly share code, notes, and snippets.

Created Dec 21, 2011
What would you like to do?
show an image snip on a canvas in a new frame
#lang racket/gui
(define (show-image-snip-in-new-frame snip)
(define bmp (send snip get-bitmap))
(define f (new frame% [label "image snip"]
[width (send bmp get-width)]
[height (send bmp get-height)]))
(define c
(new canvas%
[paint-callback (λ (c dc) (send dc draw-bitmap bmp 0 0))]
[parent f]))
(send f show #t))
(require plot)
(show-image-snip-in-new-frame (plot (function sin (- pi) pi #:label "y = sin(x)")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment