Load python function without module; custom key binding

I have found the toggleZoomSync() user function quite useful. It works very well in the Python interactor.

I wish to load it on start without creating a GUI module/extension. And also, create a keyboard shorcut (Meta+Z on Linux) for quick access. I don’t wish any GUI widget to use that function.

I should be able to create a module with the Extension Wizard if it can’t be avoided. I could find no documentation to create a custom key binding however.

Can you please advise ?

Thank you.

This example should answer all your questions:

https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Customize_keyboard_shortcuts

Yes, both questions are resolved.

Thank you very much.

1 Like