[racket] Keeping DrRacket from closing plot window

From: Neil Toronto (neil.toronto at gmail.com)
Date: Wed Feb 26 20:48:38 EST 2014

On 02/23/2014 05:17 PM, Harry Spier wrote:
> In DrRacket I'm generating some  simulations using the random function
> and plotting the results using the Racket Plot routines.  I put the plot
> results in a new window using "(plot-new-window? #t)". This works fine
> but everytime I run a new simulation  within DrRacket the previous plot
> window is closed.
> Is there a way to keep DrRacket from closing the open plot window each
> time I run a new simulation.

Sorry it took so long for me to reply.

I'm not sure there's anything you can do about it. DrRacket runs 
programs in a sandbox. When you run your program again, it dumps the old 
sandbox and makes a new one. Any GUI windows you have up get closed 
before their event handler disappears.

(I'm sure Robby or Matthew could give a better/more detailed/more 
correct answer, but I think this will do for now.)

Your best bet is to package the simulation in a function and call it 
multiple times in the REPL.

Neil ⊥

Posted on the users mailing list.