I recently spent over half a day trying to find a good example of how to build a panel with a custom property that used a slider. Eventually I found this:
import bpy
class SomePanel( bpy.types.Panel ):
bl_label = "Property panel"
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
def draw(self, context):
layout = self.layout
scn = context.scene
layout.prop( scn, 'someValue' )
#Update function example:
#self is the object to which you have assigned the property
#context is similar to the context given in the execute function of an operator
def do_update( self, context ):
if context.active_object:
context.active_object.location.x = self.someValue
print( 'update', self.someValue )
def register():
bpy.types.Scene.someValue = bpy.props.FloatProperty(name = "Float",
description = "Enter a float", min = -100, max = 100, update=do_update )
bpy.utils.register_class(SomePanel)
def unregister():
bpy.utils.unregister_class(SomePanel)
del bpy.types.Scene.someValue
if __name__ == "__main__":
register()
It seems the biggest thing to remember is the custom property is put in the register function. From this, one should be able to hack out whatever they need for their control panel.