About web-project-templates-master

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:

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

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.


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)

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 on your instance of your RemoteView.

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.