[racket-dev] Q. about "live" snips

From: John Clements (clements at brinckerhoff.org)
Date: Tue Sep 7 18:39:56 EDT 2010

I'm writing code for beginners that produces "sound" values.  I'd like to render these values as snips that have a start and a stop button.  

My first experiment looked like this:

#lang racket

(require racket/gui)

(define f (make-object image-snip% "/Users/clements/plt/collects/icons/mini-plt.xpm"))

(define (g)
  (send f load-file "/Users/clements/plt/collects/icons/j.gif"))


This "worked" in the sense that the value was rendered graphically, but "didn't work" in the sense that calling (g) didn't change an already-displayed image. Viz:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen shot 2010-09-07 at 3.37.28 PM.png
Type: image/png
Size: 10704 bytes
Desc: not available
URL: <http://lists.racket-lang.org/dev/archive/attachments/20100907/6c252ba9/attachment.png>
-------------- next part --------------
 

This suggests to me that it would be hard to implement a "sound-player-snip" that updated itself to display its status.

My hope is that I'm wrong, and there's some easy way to make snips "live" in this sense.

Any help greatly appreciated.

John

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4669 bytes
Desc: not available
URL: <http://lists.racket-lang.org/dev/archive/attachments/20100907/6c252ba9/attachment.p7s>

Posted on the dev mailing list.