How to define a shortcut in python?

I wanted to use code to define keyboard shortcuts, but I got stuck. I was wondering if there were some demos for this

#! python 3
import Rhino as rh
rh.ApplicationSettings.KeyboardShortcut()

KeyboardShortcut class

import Rhino
key = Rhino.UI.KeyboardKey.Q
modifier = Rhino.UI.ModifierKey.MacCommand
Rhino.ApplicationSettings.ShortcutKeySettings.SetMacro(key, modifier, "Isolate")
3 Likes

Very good presentation, thank you