|
From: Bruce S. <Bru...@nc...> - 2007-04-03 00:55:08
|
From the on-line help in the section on "Controlling Windows":
scene.objects is a list of all the visible objects in the display named
"scene"; invisible objects are not listed. For example, this makes all
(visible) boxes in the scene red:
for obj in scene2.objects:
if obj.__class__ == box # can say either box or 'box'
obj.color = color.red
You could use similar code to make all the visible objects invisible.
Not the same thing, but note too that you can make a window named
"scene" invisible by "scene.visible = False".
Concerning deleting objects, see the section in the on-line help on
"Deleting an Object", where you'll see that making an object invisible
doesn't delete the object from memory, because you might choose to make
it visible again later. But if you reuse the name of that invisible
object, it becomes eligible for Python to delete it from memory, because
there is now no way to access the object (to make it visible again).
Bruce Sherwood
John Salerno wrote:
> Hi everyone. I just started using the visual module and I think it's
> pretty neat so far. But one thing I couldn't find in the documentation
> was a way to clear the current "scene" completely. I know to delete
> something you can just set the visibility to 0 (although this seems
> not to work all the time), but if you have a lot on the screen and
> want to clear it all, is there a way to do this?
>
> Thanks,
> John Salerno
|