Clicking in an object

Hi all

I’m trying to select an object by clicking on it with the left mouse button. I hover the mouse over the panda and click, but nothing happens apparently. This is the code involved:

class World(DirectObject):

	def __init__(self):
		.
		.

		#Collision traverser
		self.picker = CollisionTraverser()

		#Collision handler
		self.pq = CollisionHandlerQueue()

		#Collision ray
		self.pickerNode = CollisionNode('mouseRay')
		self.pickerNP = camera.attachNewNode(self.pickerNode)
		self.pickerNode.setFromCollideMask(BitMask32.bit(1))
		self.pickerRay = CollisionRay()               #Make our ray
		self.pickerNode.addSolid(self.pickerRay)      #Add it to the collision node
		self.picker.addCollider(self.pickerNP, self.pq)
		self.pandaActor.node().setIntoCollideMask(BitMask32.bit(1))
		self.pandaActor.setTag('pandaActorTag', '1')
		
		self.accept("mouse1",self.click)
		
		.
		.
		
	def click(self):
		mpos = base.mouseWatcherNode.getMouse()
		self.pickerRay.setFromLens(base.camNode, mpos.getX(), mpos.getY())
		self.picker.traverse(render)
		#assume for simplicity's sake that myHandler is a CollisionHandlerQueue
		if self.pq.getNumEntries() > 0:
			self.pq.sortEntries() #this is so we get the closest object
			self.pickedObj=pq.getEntry(0).getIntoNodePath()
			self.pickedObj=pickedObj.findNetTag('myObjectTag')
			print "You have clicked on the panda"
			if not pickedObj.isEmpty():
				handlePickedObject(pickedObj)
				print "You have clicked on the panda"
		.
		.

Any suggestion? I can post the whole code if it helps, but I didn’t want to put everything as it is a bit long.

Thanks

did you passed here?
if not, it is a little snippet showing off how to select an object or even bunch of objects clicking and dragging a rectangle. check that out and maybe you’ll find there your answers