How to implement mouse control

I was reading the documentation on interfacing the mouse within the game and it dint say any control fuction for example in the keyboard section,it had a number ways you could pick information from the keyboard such as ‘left_arrow-up’ and ‘left_arrow-repeat’.
Can that also be done with the mouse for example i want something to constanlty happen when the left button of the mouse is pressed down and stops when the mouse button is released.If panda3d can do that,i would be greatefull for any one who could tell me how it is done.
thanks greatly.

The place to look is this manual page:

It shows a list of the events you need, such as “mouse1” which is sent when the left mouse button is pressed and “mouse1-up” which is sent when the left mouse button is released.

okay but how do i put that in code and isnt there an event where it does something continually until the mouse button is released.

I think i have an idea of how to do it

         def exampleTask(mouse1): 
                  do code
                 return Task.cont

would be this be right way to go about it and if it was woudnt the code continue infinilty when the mouse button is pressed.

Thanks grealty

The mouse1 event you can catch using:
accept(‘mouse1’, myfunction)

where myfunction is a function that is called once when the left mouse button is clicked. You can do something similar for mouse1-up.

So these functions are only called once every time the left mouse button is pressed down or released. If you want a function to be called every frame while the button is pressed down, you could use a task. You could start the task on the “mouse1” event and stop it on the “mouse1-up” event.

Thanks very much
It all works good now