# About web-project-templates-master

**URL:** <https://discourse.vtk.org/t/about-web-project-templates-master/4975>\
**Category:** Development\
**Created:** [January 10, 2021, 11:41pm UTC](https://discourse.vtk.org/t/about-web-project-templates-master/4975 "2021-01-10T23:41:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luis\_Carlos\_Carneiro](https://discourse.vtk.org/user_avatar/discourse.vtk.org/luis_carlos_carneiro/32/1360_2.png) [@Luis\_Carlos\_Carneiro](https://discourse.vtk.org/u/Luis_Carlos_Carneiro)\
**Post date:** [January 10, 2021, 11:41pm UTC](https://discourse.vtk.org/t/about-web-project-templates-master/4975/1 "2021-01-10T23:41:17Z")

</div>

Dear All,

I want to make a function handler of the mouse at vtk\_protocol.py. I inserted the following code in the class VtkCone:

```
@exportRpc("viewport.mouse.interaction")
def updatemousedoublecone(self, event):
    frequency = 2500 # Set Frequency To 2500 Hertz
    duration = 1000 # Set Duration To 1000 ms == 1 second
    winsound.Beep(frequency, duration)
    print("I am here\n")

```

* * *

When it is ran the server and the page “localhost:1234” in the browser the beep sounds when it is pressed the left button of the mouse (perhaps right also and perhaps added movement of the mouse).

I want that the beep sounds only with the movement of the mouse alone.

Where must be changed code or flags and which to achieve that?

I want to thanks in advance for the possible help,

Luís Gonçalves

---

<div class="post-metadata">

**Author:** ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)\
**Post date:** [January 11, 2021, 4:42pm UTC](https://discourse.vtk.org/t/about-web-project-templates-master/4975/2 "2021-01-11T16:42:32Z")

</div>

Why don’t you look at the content of `event` (i.e: print). I bet there is an `action` field that has a value `move` when the event is of type `move`.  
So if you guard your beep with `if event['action'] == 'move':` that should do what you are hoping for.

HTH

---

<div class="post-metadata">

**Author:** ![Luis\_Carlos\_Carneiro](https://discourse.vtk.org/user_avatar/discourse.vtk.org/luis_carlos_carneiro/32/1360_2.png) [@Luis\_Carlos\_Carneiro](https://discourse.vtk.org/u/Luis_Carlos_Carneiro)\
**Post date:** [January 11, 2021, 5:36pm UTC](https://discourse.vtk.org/t/about-web-project-templates-master/4975/3 "2021-01-11T17:36:24Z")

</div>

The events are “up” and “down” but only happen with the button of the mouse pressed (mouse on move also). Not with the mouse moving alone (without pressing the button)

Also the problem is that “viewport.mouse.interaction” handler replaces the the handler of VTK (I suppose) that rotates the Cone (with mouse button pressed and moving)

---

<div class="post-metadata">

**Author:** ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)\
**Post date:** [January 11, 2021, 6:32pm UTC](https://discourse.vtk.org/t/about-web-project-templates-master/4975/4 "2021-01-11T18:32:06Z")

</div>

To send the mouse when not down, you need to tell the client to actually send the mouse to the server by changing that [flag](https://github.com/Kitware/vtk-js/blob/master/Sources/Interaction/Style/InteractorStyleRemoteMouse/index.js#L291) on your instance of your RemoteView.

---

<div class="post-metadata">

**Author:** ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)\
**Post date:** [January 11, 2021, 6:33pm UTC](https://discourse.vtk.org/t/about-web-project-templates-master/4975/5 "2021-01-11T18:33:45Z")

</div>

Just redo what the working one from VTK is doing inside your code. And just expand it with what you want to do with your beep.
