Subject | : Re: SAD problem with ploting |
Date | : 2007/02/15(Thu) 14:39:52 |
Contributor | : K. Oide |
One solution is something like
FFS;
w = KBMainFrame["w",f,Title->"abc"];
b = Button[f,Text->"abc",Command:>(
w1 = Window[Title->"plot"];
Bind[w1,"<Destroy>",
CanvasGraphics@CanvasObject[c1]=.;
c1=.;w1=.];
c1 = Canvas[w1];
Canvas$Widget=c1;
plot1 = Plot[Sin[x],{x,-Pi,Pi}]
)];
TkWait[];
to define a call back when w1 is destroyed, to clean up c1, w1, and CanvasGraphics@CanvasObject[c1]. The last one is a hidden object associated with CanvasDrawer.
Still it may consume some memories by making/killing the memory in this way. So I recommend to use a fixed window and canvas. Instead of destroying the window, you can show/hide it.