question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

About the mouse move event

See original GitHub issue

The example provides an example about how to implement user-self mouse event:

from vedo import *


def onLeftClick(mesh):
    printc("Left   button pressed on", [mesh], c="g")


def onMiddleClick(mesh):
    printc("Middle button pressed on", [mesh], c="y")


def onRightClick(mesh):
    printc("Right  button pressed on", [mesh], c="r")


vp = Plotter()

vp.load(datadir+"teapot.vtk").c("gold")

vp.mouseLeftClickFunction   = onLeftClick
vp.mouseMiddleClickFunction = onMiddleClick
vp.mouseRightClickFunction  = onRightClick

printc("Click object to trigger function call", invert=1, box="-")

vp += __doc__
vp.show()

The above code shows the left/middle/right click event. I wonder how to implement the mouse move event?

In addition, the onLeftClick is called by:

        plotter::_mouseleft(self, iren, event):
             ...vedo code
             if self.mouseLeftClickFunction:
                 self.mouseLeftClickFunction(clickedActor)

Actually, the vedo will finish some code, and then call self.mouseLeftClickFunction(clickedActor). If I don’t need the ...vedo code, I want vedo can directly call my-self onLeftClick, how can I achieve this purpose? Thank you in advance.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
zhang-qiang-githubcommented, Dec 1, 2020

@marcomusy Really thank you for your very nice reply.

1reaction
zhang-qiang-githubcommented, Dec 1, 2020

@marcomusy Thank you very much. vp.interactor.RemoveAllObservers() is what I want. I can remove all observers, and add what I want. In this way, I can control all the event call back funtion.

Read more comments on GitHub >

github_iconTop Results From Across the Web

onmousemove Event - W3Schools
The onmousemove event occurs when the pointer moves over an element. Mouse Events. Event, Occurs When. onclick, The user clicks on an element....
Read more >
How mousemove Event Works in Javascript? - eduCBA
MouseMove is a simple event that is executed when a pointer is moving over or around an element. Mousemove is a javascript event...
Read more >
MouseMove event | Microsoft Learn
The MouseMove event applies to forms, controls on a form, and labels. MouseMove events are generated continually as the mouse pointer moves ...
Read more >
Mouse events - The Modern JavaScript Tutorial
Mouse event types · mousedown/mouseup: Mouse button is clicked/released over an element. · mouseover/mouseout: Mouse pointer comes over/out from ...
Read more >
.mousemove() | jQuery API Documentation
The mousemove event is sent to an element when the mouse pointer moves inside the element. Any HTML element can receive this event....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found