From: Guy K. K. <g....@ma...> - 2009-06-29 01:24:39
|
On Mon, 29 Jun 2009 11:28:22 Bruce Sherwood wrote: > Here's what I've put into the documentation at vpython.org (and will go > into the documentation that is installed locally for Visual): > > > To hide a Visual object just make it invisible: ball.visible = 0. This does > not delete the object from computer memory, and you can make it visible > again later. > > If however you later re-use the name ball, for example by creating a new > object and naming it ball, Python will be free to release the memory used > by the object formerly named ball (assuming no other names currently refer > to that object). If the object is visible when you re-use the name ball, > the original object will not be deleted from computer memory, and it will > remain visible in the window. > > Suggestions for improvement? You might want to add something how to explicitly delete items as well. E. g. to remove them *now* call "del foobar" after setting the object to "obj.visible = False". BTW, I'd also suggest to use "ball.visible = False" rather than "... = 0". The boolean nature is much more expressive, and it also implies that you don't have a "value" there, which could be interpreted as visible = 0.5 is like opacity and makes it only half visible. This change would remove ambiguity straight off the bat. Guy -- Guy K. Kloss Institute of Information and Mathematical Sciences Te Kura Pūtaiao o Mōhiohio me Pāngarau Massey University, Albany (North Shore City, Auckland) 473 State Highway 17, Gate 1, Mailroom, Quad B Building voice: +64 9 414-0800 ext. 9585 fax: +64 9 441-8181 G....@ma... http://www.massey.ac.nz/~gkloss |