Add button to TOPBAR_MT_render I want to add a button to the “TOPBAR_MT_render” menu (basically the menu in the top bar were you click to render.) The button should look like the Lock Interface one, so it should have a checkbox.



Would be nice if you could help me with this.
Append or Prepend a draw method to menu class. 

Very closely related How to add a checkbox to a pie menu?



import bpy

def draw(self, context):
    layout = self.layout
    scene = context.scene
    render = scene.render

    layout.prop(render, "use_lock_interface")

def register():
    bpy.types.TOPBAR_MT_render.append(draw)

# make your unregister and remove draw
if __name__ == "__main__":
    register()


TIP Turn on developer extras in user preferences and can right click to  view source (Edit Source, as it opens in text editor.) of most UI elements.

Add toggle hotkey to custom checkbox