From: Jonathan B. <jbr...@ea...> - 2006-02-14 18:48:21
|
On Mon, 2006-02-13 at 16:53 +0100, leau2001 wrote: > Hi all, > > Is it not possible to make sphere have a new option : name > > I know we uses name= sphere ..... > > But i'd prefer sphere ( option1..., .., name='texte') > > i explain Yes, in a sense. When you instantiate any VPython renderable object, any extra parameters you provide will be automatically added as attributes of whatever you are creating. So: >>> x = sphere( name='texte') >>> print x.name 'texte' > I made 4 sphere, and i want to see sphere.name on a label when i click > on a sphere. See also the display.getclick(), display.getevent() functions. These return a reference to the nearest (closest to the screen) VPython object that was clicked (if any was below the mouse cursor). You can then have a label associated with each sphere, and control it's visibility when you process the event. If you wanted to always move the label and sphere together around the screen, you can easily wrap them together in a common frame. HTH, -Jonathan |