From: Bruce S. <Bru...@nc...> - 2009-06-29 21:36:14
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=UTF-8" http-equiv="Content-Type"> </head> <body bgcolor="#ffffff" text="#000000"> Makes sense; thanks. I considered saying something about del but for no good reason didn't. <br> <br> I should go through all the docs and change 1/0 to True/False. The history is that in 2000 Python didn't have True/False. At some point Scherer implemented true=1 and false=0, but the documentation didn't exploit this. And then even later True/False got added to Python; I don't remember when that happened.<br> <br> Bruce Sherwood<br> <br> Guy K. Kloss wrote: <blockquote cite="mid:200...@ma..." type="cite"> <pre wrap="">On Mon, 29 Jun 2009 11:28:22 Bruce Sherwood wrote: </pre> <blockquote type="cite"> <pre wrap="">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? </pre> </blockquote> <pre wrap=""><!----> 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 </pre> </blockquote> </body> </html> |