Skip to content

Request to add set_on_key for open3d.visualization.O3DVisualizer in Python #7226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
3 tasks done
m-shahbaz-kharal opened this issue Apr 17, 2025 · 1 comment
Open
3 tasks done

Comments

@m-shahbaz-kharal
Copy link

Checklist

Proposed new feature or change

open3d.visualization.O3DVisualizer is an amazing out-of-box class as it provides many built-in features, however, there's no option for developers to add custom keyboard key handling to it. It is, therefore, requested that set_on_key should be exposed. I believe it is simple and clutter free to include this feature as open3d.visualization.O3DVisualizer inherits from open3d.visualization.gui.Window that has SetOnKeyEvent, so adding something like following to cpp/pybind/visualization/o3dvisualizer.cpp under pybind_o3dvisualizer_definitions should work just fine:

.def("set_on_key", &O3DVisualizer::SetOnKeyEvent,
     "Sets a callback that will be called when a key is pressed. "
     "The callback will be given the key event and should return "
     "True if the event was handled, or False if it was not.",
     "callback"_a);

References

No response

Additional information

I previously only used pip package of Open3D, so please let me know if this solution is not ideal or against design principles of Open3D.

@timohl
Copy link
Contributor

timohl commented Apr 17, 2025

If you create a PR I think it would be faster to get implemented/reviewed/merged.
Seems like a small but useful change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants