From: Stef M. <s.m...@ru...> - 2008-11-28 14:36:25
|
thanks Bruce, Bruce Sherwood wrote: > From the section of the help titled "Deleting an object" there is this: I thought I printed everything, but I missed that small piece of doc. That brings up the following: wouldn't be a good idea to merge all the tiny html docs into just 1 pdf file ? > > To delete a Visual object just make it invisible: ball.visible = 0 > > Technical detail: If 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 you simply make an object invisible, you might later make it > visible again. But if you reassign the name, there is no longer any > way for your program to access the object, so its memory can be > released.) > > Similarly, a display such as scene can also be made invisible > (scene.visible = 0), and if its name is reassigned the memory is > released. > > If on the other hand you want to keep the window visible but remoe all > objects from it, you need to make all the objects in the display > invisible. In the section titled "Controlling Windows" there is this > note about how to get at all the (visible) objects in a display: > > objects A list of all the visible objects in the display; invisible > objects are not listed. For example, this makes all boxes in the scene > red: > > for obj in scene2.objects: > if obj.__class__ == box # can say either box or 'box' > obj.color = color.red Aha, that's what I really need, as I dock the scene (so it's complex to define a new one and dock it again), and I don't know what objects are on. thanks very much. Maybe I've not yet the right to do suggestions (didn't really use Vpython), but on the other hand these first suggestions are often forgotten when you start knowing an environement and find work arounds. So I do them anyway: - set one way autoscale: autoscale can zoom out to show the whole environment if the environment grows, but it's not allowed to shrink - set the maximum/minimum values of zoomfactor. I use a pen instead of a mouse, which is much faster, when I try to zoom, I loose my picture within sceonds by zooming too much in or out. The only way to restore that is to restart the program :-( btw, I love the way VPython is automated, so you only have to deal with the real problem you're interested in, great ! btw2, I'll try to make a demo this weekend, showing how I integrated VPython in PyLab_Works. cheers, Stef > Bruce Sherwood > > Stef Mientki wrote: >> hello, >> >> I have a few simple questions, >> for which I can't find the answer in the doc: >> >> - how can I remove an object from the scene ? >> - how can I clear the whole scene ? >> >> thanks, >> Stef Mientki >> >> > > |