blender/release/scripts/templates_py/ui_panel_simple.py

39 lines
837 B
Python
Raw Normal View History

import bpy
class HelloWorldPanel(bpy.types.Panel):
"""Creates a Panel in the Object properties window"""
bl_label = "Hello World Panel"
bl_idname = "OBJECT_PT_hello"
2012-07-04 21:41:05 +00:00
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "object"
2010-01-31 14:46:28 +00:00
def draw(self, context):
layout = self.layout
2010-01-31 14:46:28 +00:00
obj = context.object
row = layout.row()
row.label(text="Hello world!", icon='WORLD_DATA')
row = layout.row()
row.label(text="Active object is: " + obj.name)
row = layout.row()
row.prop(obj, "name")
row = layout.row()
row.operator("mesh.primitive_cube_add")
def register():
bpy.utils.register_class(HelloWorldPanel)
def unregister():
bpy.utils.unregister_class(HelloWorldPanel)
if __name__ == "__main__":
register()