From: Bruce S. <bas...@un...> - 2002-07-25 03:52:31
|
Attached is a significantly improved routine for making hollow cylinders (tubes). You can now set the attributes (pos, axis, r1, r2, color) and change the appearance of an existing tube, just as with regular built-in Visual objects. I don't think the "property" machinery used in tube.py is discussed in the standard Python documentation, being relatively new. You can find a discussion in the auxiliary documents at http://python.org associated with the Python 2.2 release. It is an improved mechanism for handling special processing when reading (getattr) or writing (setattr) an attribute of an object. An important detail that's easy to miss is that in the "class" statement you have to specify the word "object" in parentheses, as in "class tube(object):", which gets you new-style Python object behavior. Bruce Sherwood |