views:

152

answers:

3

Is there something similar to scene.mouse.getclick in the visual module (VPython)? I need it for a rollover. Thanks in advance.

EDIT: I need a function for doing something when the mouse moves inside a special area without clicking.

A: 

Well, do you mean the scene.mouse.getclick() described here in the documentation?

I don't know what you mean by

Is there something similar...

What are you looking for?

jcao219
A: 

scene.mouse.getclick will tell you where the mouse was when it was last clicked. This is different from scene.mouse.clicked which tells you if someone clicked.

There is no correspoding way to see if someone had their mouse over a particular object. One thing you can do is use a while loop that continually checks scene.mouse.pick to see if it is the mouse is currently over an object of interest.

mathmike
Hello mathmike. This seems to be some part of the solution. But it is not what i am looking for. Maybe it is not existing yet. I need the scene-position.
kame
I'm not sure exactly what "scene-position" means, but after you learn that the mouse is over an object of interest, you can use other commands like "scene.mouse.pickpos" to learn things like where the mouse is. More commands are available in the documentation:http://www.vpython.org/webdoc/visual/mouse.html
mathmike
+1  A: 

As mentioned by mathmike, it would seem that you could use scene.mouse.pick to get the object that is currently under the mouse, and as for the 'scene-position', I think scene.mouse.pickpos is what you're looking for - if not, you should be able to calculate it from the global mouse position (through getEvent()).

Otherwise, look at getting your information from the getEvent() function, and possibly writing an event loop for yourself.

foxwoods