import bpy
def draw_auto_key_button(self, context):
layout = self.layout
layout.prop(context.scene.tool_settings, "use_keyframe_insert_auto", toggle=True, text="Auto Key")
def register_dopesheet_button():
bpy.types.DOPESHEET_HT_header.append(draw_auto_key_button)
def register_graph_editor_button():
bpy.types.GRAPH_HT_header.append(draw_auto_key_button)
def unregister_dopesheet_button():
bpy.types.DOPESHEET_HT_header.remove(draw_auto_key_button)
def unregister_graph_editor_button():
bpy.types.GRAPH_HT_header.remove(draw_auto_key_button)
def register():
register_dopesheet_button()
register_graph_editor_button()
def unregister():
unregister_dopesheet_button()
unregister_graph_editor_button()
if __name__ == "__main__":
register()