Creating a hotkey for a checkbox item?

I can’t seem to find how to create a working shortcut for a checkbox in Blender. I am a little rusty - just coming back. But I think there is wm.toggle for modes and something else for buttons. I want to create a hotkey for Camera Lock To View: “spaceview3d.lock_camera” Can’t seem to figure it out and Google is useless as usual. Anyone else notice how hard it is to search for specific things in Google the last few years?

Hey thanks for the help!

In 3D View / 3D View (Global):

That works perfectly! Thank you! Now I can position the view from the camera like a boss…

One more question… How did you know this? I mean I can come in here and post a question every time I want to assign a hotkey, but you guys might get tired of that :stuck_out_tongue: So how did you know what was needed for this hotkey? In other words, for future reference, what is it you did that I need to learn how to do that allowed you to figure out or know that this is what was needed for the hotkey?

Whew! That was hard to ask… But try Googling for creating Blender hotkeys and you’ll want to pull your hair out too…

In this case my thinking was:
I did not know what the format should be so I just followed some logical steps.
The toggle lock camera option is used in both object and edit mode so the shortcut needs to work in both, hence put it in 3d View / 3D View (Global) section
wm.context_toggle is used to toggle other options in use preferences so likely to be the case here as well
Then look at the python code in the tooltip

It is SpaceView3D.lock_camera.
So what format would that need to be in the shortcut. Look for an existing shortcut that has a python code that starts with SpaceView3D and copy its format. There is one already, Manipulate Center Points

If you look at the shortcut for this you will see the format is “space_data.use_pivot_point_align”.
Therefore copying this format for the lock camera option would give the “space_data.lock_camera”
I tried using this and it worked