|
From: Dunning, R. <dun...@lo...> - 2007-05-30 17:46:56
|
Theo,
"objects" is list of all *visible* objects in the display. When you loop
over scene.objects, any objects tagged as invisible are automatically
skipped in the loop because they're not part of that list. I'm not sure I
would call this a bug--it's how the class is coded.
I came up with the following that may do what you need. (By the way, if you
chose to reinstantiate the non-visible objects, the memory tied up by the
former objects should be released.)
from visual import *
rate(10)
spheres = []
for i in xrange(7):
spheres.append(sphere(pos=vector(i*3,0,0)))
scene.my_objects = spheres
for i in scene.objects:
i.visible = 0
print "They're gone!"
print "Bring them back"
for j in scene.objects:
j.visible = 1 # Doesn't work, as you've discovered.
print "Now try it."
for a in scene.my_objects: # This will work.
a.visible = 1
# Hope this helps.
--
Rodney Dunning
Assistant Professor of Physics
Longwood University
http://www.longwood.edu/staff/dunningrb
> -----Original Message-----
> From: vis...@li...
> [mailto:vis...@li...] On
> Behalf Of Theo DuBose
> Sent: Wednesday, May 30, 2007 1:31 PM
> To: vpython
> Subject: [Visualpython-users] Visibility Bug?
>
> Hello,
>
> I have noticed what appears to be a bug when dealing with
> frames and visibility. If I make all the objects in the frame
> disappear, with
>
> for obj in a.objects:
> obj.visible = 0
>
> and then attempt to make the objects reappear with
>
>
> for obj in a.objects:
> obj.visible = 0
>
> They do not appear. Is this a known, or does anyone have any
> suggestions? Presently I am overcoming this by
> reinstantiating the invisible objects, but i would like to be
> able to reduce the amount of memory this uses.
>
> Thanks,
> Theo
>
> --------------------------------------------------------------
> -----------
> This SF.net email is sponsored by DB2 Express Download DB2
> Express C - the FREE version of DB2 express and take control
> of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Visualpython-users mailing list
> Vis...@li...
> https://lists.sourceforge.net/lists/listinfo/visualpython-users
>
|