Very basic problem: define Custom Shapes for bones

I am creating a Blend file to whose purpose is to add Custom Shapes to all the control bones on the Metarig template in Blender 2.5.

Structurally, the scene already contains the widgets I want to use as custom shapes. The process would be you make your metarig, adjust it and generate the rig. Then, you would run the script in the script window, which would assign widget A to bone B.

I don’t even want fancy stuff. In the same way you would just say “The object I’m talking about is Bone. Bone’s X value is 5,” I just want to specify a bone and specify a widget as a Custom Shape. If I can get that far, I’d just copy-pasta the thing over and over and change names for each bone and each widget.

Here’s a more visual explanation…

Sorry to n00b it up…

Fixed it! Thanks to my boss, who helped me out even though he doesn’t know python…

For other total n00bs, I have discovered that the autofill option in the console window will take you very far…

import bpy

bpy.data.objects['Armature'].pose.bones['Bone1'].custom_shape = bpy.data.objects['wgt_bone1']
bpy.data.objects['Armature'].pose.bones['Bone2'].custom_shape = bpy.data.objects['wgt_bone2']