|
From: Bill W. <ww...@la...> - 2007-05-31 15:41:00
|
Sorry Theo! I guess the lesson is test your code before posting to the
list, no matter what. At least Rodney had a "classic Python" issue, mine is
more just bone-headed.
In cutting and pasting the Frame class from my little module, I omitted the
declaration below, and that's the source of the problem. It just creates a
'show' function that will work on any visual object, not just a Frame
instance. I didn't notice the call to it buried in the class declaration
(funny that it reaches into email.py, otherwise!).
def show(obj, state=None):
"""Set the visible tag of an object, or, if an object.show() exists,
(see Frame class below), propagate the call to set internal
objects. Call with a Boolean argument, or None to toggle current
visibility state."""
if hasattr(obj,'show'):
obj.show(state)
else:
if state == None:
obj.visible = not obj.visible
else:
obj.visible = state
There was another over simplification with my use of scene.kb, so I'm
attaching a complete example that should work without confusion, and I added
a demo of how I might do animation with it also. Let me know if it gives
you any more headaches.
Bill
-----Original Message-----
From: vis...@li...
[mailto:vis...@li...] On Behalf Of Theo
DuBose
Sent: Wednesday, May 30, 2007 7:19 PM
To: vpython
Subject: Re: [Visualpython-users] Visibility Bug?
Bill,
Thanks, that seems like a good idea, but when I try to use it, I get the
error:
Traceback (most recent call last):
File "/Users/Theo/Documents/email2.py", line 7, in <module>
f.show(0)
File "/Users/Theo/Documents/email.py", line 11, in show
show(obj,self.visible)
NameError: global name 'show' is not defined
I assume this is a problem with recursion; how do I fix this?
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
|