Change default key -- 'P' -- for picking under the mouse to other key #4951
Unanswered
AlexanderG77
asked this question in
Q&A
Replies: 1 comment
-
|
That P key comes directly from the VTK interaction style and isn't easy to change. However, you can add additional keys to trigger the pick event by borrowing some of our internal implementations: pyvista/pyvista/plotting/picking.py Lines 30 to 37 in d72ba08 pyvista/pyvista/plotting/picking.py Lines 321 to 331 in d72ba08 pyvista/pyvista/plotting/picking.py Lines 306 to 319 in d72ba08 Here's one example: import pyvista as pv
pl = pv.Plotter(notebook=False)
pl.add_mesh(pv.Sphere())
pl.enable_point_picking()
pl.track_mouse_position() # continous mouse position tracking (can have performance implications)
pl.add_key_event("t", pl.pick_mouse_position)
pl.show() |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
How to change the default 'P' key for picking a point on the surface of a mesh, using pyvista.Plotter.enable_surface_point_picking(), to any other key(s)?
I am aware about binding a callback function to a key event with pyvista.Plotter.add_key_event(), but I can not figure out what function is called when pressing 'P' after pyvista.Plotter.enable_surface_point_picking().
Beta Was this translation helpful? Give feedback.
All reactions