[vtkusers] Picking questions

Prabhu Ramachandran prabhu at aero.iitm.ernet.in
Wed Oct 23 16:29:50 EDT 2002


>>>>> "PS" == P Sherwood <Sherwood> writes:

    PS>     # actor a represents atom at in molecule m
    PS> a.AddObserver('PickEvent', \ lambda
    PS> obj,ev,s=self,mol=m,atom=at : s.mypick(mol,atom,obj,ev)

    PS> I still feel it looks like a rather complicated way of
    PS> providing some user data for when the pick event happens. It
    PS> seems to work, but if there is a nicer way I'd like to know!

Why not simply 

  a.AddObserver('PickEvent', self.mypick)

Afterall your class will have all the necessary data?  self.mypick is
a bound function also classifies as a function.  So as soon as your
actor is picked the class does what is necessary.  By distributing
responsibilities properly everything should work just fine.

cheers,
prabhu




More information about the vtkusers mailing list