From: Bruce S. <Bru...@nc...> - 2008-11-28 01:59:24
|
From the section of the help titled "Deleting an object" there is this: 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 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 > > |