stuck with tutorial

so i started learning the blender game engine, and while browsing tutorials on blender cookie, couldn’t stop myself from trying one out. However, it wont work! it seems to be all correct to me but the panel wont appear. Help is appreciated.


import bpy

class addObjectPrimitives(bpy.types.Panel):
    bl_label = "Add Object Primitives"
    bl_space_type = "VIEW_3D"
    bl_region_type = "TOOLS"
    bl_context =  "objectmode"
  
    def draw(self, context):
        layout = self.layout
        col = layout.column(align=True)
        if bpy.context.object:
            col.prop(bpy.context.object, "name")
            col = layout.column(align=True)
        col.operator("mesh.primitive_plane_add", icon = "MESH_PLANE")
        col.operator("mesh.primitive_cube_add",  icon = "MESH_cUBE")
        col.operator("mesh.primitive_circle_add",icon = "MESH_cIRCLE")
        col.operator("mesh.primitive_uv_sphere_add", icon = "MESH_UVSPHERE")
        col.operator("mesh.primitive_ico_sphere_add", icon = "MESH_ICOSPHERE")
        col.operator("mesh.primitive_cylinder_add", icon = "MESH_CYLINDER")
        col.operator("mesh.primitive_cone_add", icon = "MESH_CONE")
        col.operator("mesh.primitive_grid_add", icon = "MESH_GRID")
        col.operator("mesh.primitive_monkey_add", icon = "MESH_MONKEY")
        col.operator("mesh.primitive_torus_add", icon = "MESH_TORUS")

class addMeshPrimitives(bpy.types.Panel):
    bl_label = "Add Object Primitives"
    bl_space_type = "VIEW_3D"
    bl_region_type = "TOOLS"
    bl_context =  "mesh_edit"
  
    def draw(self, context):
        layout = self.layout
        col = layout.column(align=True)
        if bpy.context.object:
            col.prop(bpy.context.object, "name")
            col = layout.column(align=True)
        col.operator("mesh.primitive_plane_add", icon = "MESH_PLANE")
        col.operator("mesh.primitive_cube_add",  icon = "MESH_cUBE")
        col.operator("mesh.primitive_circle_add",icon = "MESH_cIRCLE")
        col.operator("mesh.primitive_uv_sphere_add", icon = "MESH_UVSPHERE")
        col.operator("mesh.primitive_ico_sphere_add", icon = "MESH_ICOSPHERE")
        col.operator("mesh.primitive_cylinder_add", icon = "MESH_CYLINDER")
        col.operator("mesh.primitive_cone_add", icon = "MESH_CONE")
        col.operator("mesh.primitive_grid_add", icon = "MESH_GRID")
        col.operator("mesh.primitive_monkey_add", icon = "MESH_MONKEY")
        col.operator("mesh.primitive_torus_add", icon = "MESH_TORUS")


]

here is a link to the tutorial:

error is also appreciated :wink:

there is no error, it just doesn’t work

have you registered those classes ? if so please use pasteall or pastbin to paste full source

if you have not , yes its normal that it does not work.

the lower case in the cube & circle icon lines will fail.

thanks for pointing out the lowercase! the font in notepad wasn’t very good! i hate windows but i dont know how to get the system console on ubuntu.

I fixed the c’s but it still wont display the panel when i run the script

I copy/pasted your code, made the corrections Meta-Androcto pointed, registered the classes as kilon said adding at the end:

bpy.utils.register_class(addObjectPrimitives)
bpy.utils.register_class(addMeshPrimitives)

and it seems to work

Thanks guys : )
just got back to this and its working! Blender artists is a great community : D