Python 中的鼠标悬停事件 (VPython)

发布于 2024-08-29 08:34:39 字数 109 浏览 2 评论 0原文

视觉模块(VPython)中有类似scene.mouse.getclick的东西吗? 我需要它来进行翻转。 提前致谢。

编辑:我需要一个函数,当鼠标在特殊区域内移动而不单击时执行某些操作。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

物价感观 2024-09-05 08:34:39

正如 mathmike 所提到的,您似乎可以使用 scene.mouse.pick 来获取当前位于鼠标下方的对象,至于“场景位置”,我认为 scene.mouse.pickpos 就是您想要的寻找 - 如果没有,您应该能够从全局鼠标位置计算它(通过 getEvent())。

否则,请考虑从 getEvent() 函数获取信息,并可能为自己编写一个事件循环。

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.

尤怨 2024-09-05 08:34:39

好吧,你的意思是此处中描述的 scene.mouse.getclick()文档?

我不知道你的意思

有没有类似的...

你在找什么?

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?

终止放荡 2024-09-05 08:34:39

scene.mouse.getclick 会告诉您上次单击鼠标时的位置。这与 scene.mouse.clicked 不同,后者告诉您是否有人单击。

没有相应的方法来查看某人是否将鼠标悬停在特定对象上。您可以做的一件事是使用 while 循环不断检查 scene.mouse.pick 以查看鼠标当前是否位于感兴趣的对象上。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文