This script was suppose to create a tab on tools panel and add a button in it.

But after I run just the panel is added. Any directions what I am doing wrong?

import bpy
from bpy.types import Menu, Panel, UIList

class View3DPanel():
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'TOOLS'

class MyPoseLibraryPanel(View3DPanel, Panel):
    bl_label = "Legs"
    bl_context = "posemode"
    bl_category = "My Pose Library"

    def draw(self, context):
        layout = self.layout
        col = layout.column(align=True)
        layout.operator("bpy.ops.pose.select_all(action='TOGGLE')", text="Legs.Idle.1", icon="MOD_ARMATURE")

def register():

def unregister():

if __name__ == "__main__":

print("my stuff loaded")               

enter image description here


1 Answer 1


Line 16 should read:

layout.operator("pose.select_all", text="Legs.Idle.1", icon="MOD_ARMATURE")

You aren't giving the full path and the parameters. You are choosing an operator so Blender already knows that it is in "bpy.ops". When the user pushes the button, he will set the values.

If you want to make sure you use your own hard-coded values, make your own operator class, that calls the bpy.ops.pose.select_all() operator inside of it with desired parameters, or catch the result of the operator layout definition in a variable, and set the parameters like this:

# catch the defined operator in a variable
myOperator = layout.operator("pose.select_all", text="Legs.Idle.1", icon="MOD_ARMATURE")

# set the options on that var. Add as many as needed
  • $\begingroup$ added some more info to your answer, hope you don't mind $\endgroup$
    – aliasguru
    Commented Dec 4, 2016 at 14:13
  • $\begingroup$ @aliasguru Thanks, I didn't even think of that! $\endgroup$
    – JakeD
    Commented Dec 4, 2016 at 14:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .