well I tried to mix everything here,but it fails with the sliders 
import bpy
from bpy.props import IntProperty, FloatProperty, StringProperty, BoolProperty
def main(context):
for ob in context.scene.objects:
print(ob)
class SimpleOperator(bpy.types.Operator):
"""Tooltip"""
bl_idname = "object.simple_operator"
bl_label = "Simple Object Operator"
my_value = bpy.props.StringProperty(default = "NA")
my_float = bpy.props.FloatProperty(default = 0.0)
slider1 = IntProperty(name="One", description="Example Tooltip", min=0, max=12, default=6)
slider2 = IntProperty(name="Two", description="Example Tooltip", min=-10, max=10)
slider3 = IntProperty(name="Three", description="Example Tooltip", soft_min=-20, soft_max = 20)
slider4 = IntProperty(name="Four", description="Example Tooltip", min=500, max=5000, subtype="FACTOR")
@classmethod
def poll(cls, context):
return context.active_object is not None
def execute(self, context):
print(self.my_value)
print(self.my_float)
#main(context)
return {'FINISHED'}
class HelloWorldPanel(bpy.types.Panel):
"""Creates a Panel in the Object properties window"""
bl_label = "Hello World Panel"
bl_idname = "OBJECT_PT_hello"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "object"
def draw(self, context):
layout = self.layout
layout.operator("object.simple_operator", icon="ZOOMIN", text="Hello").my_value = "Hello"
layout.operator("object.simple_operator", icon="ZOOMOUT", text="World").my_value = "World"
layout.operator("object.simple_operator", icon="ZOOMIN", text="float").my_float = -1.0
props = layout.operator("object.simple_operator")
props.my_value = "Hello"
props.my_float = 5.0
layout.label("Sliders:")
layout.prop(self, "slider1")
layout.prop(self, "slider2")
layout.prop(self, "slider3", slider=True)
layout.prop(self, "slider4", text="New name")
def register():
bpy.utils.register_class(SimpleOperator)
bpy.utils.register_class(HelloWorldPanel)
def unregister():
bpy.utils.unregister_class(SimpleOperator)
bpy.utils.unregister_class(HelloWorldPanel)
if __name__ == "__main__":
register()
here is the error
\Text:54
rna_uiItemR: property not found: OBJECT_PT_hello.slider2
\Text:55
rna_uiItemR: property not found: OBJECT_PT_hello.slider3
\Text:56
rna_uiItemR: property not found: OBJECT_PT_hello.slider4
\Text:57
rna_uiItemR: property not found: OBJECT_PT_hello.slider1