I want to show an Image in my UI
I found the same question here but It didn't work for me
I haven't any error but It didn't show an Image in UI
import bpy
class ADDONNAME_PT_main_panel(bpy.types.Panel):
bl_label = "Main Panel"
bl_idname = "ADDONNAME_PT_main_panel"
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_category = "New Tab"
def draw(self, context):
layout = self.layout
scene = context.scene
obj = context.object
row = layout.row()
image = bpy.data.images.load("C:/Users/Kamali/Desktop/Test.png")
row.template_ID_preview(image, "image", open="image.open")
row.operator("addonname.myop_operator")
row = layout.row()
class ADDONNAME_OT_my_op(bpy.types.Operator):
bl_label = "Operator"
bl_idname = "addonname.myop_operator"
def execute(self, context):
scene = context.scene
return {'FINISHED'}
classes = [ADDONNAME_PT_main_panel, ADDONNAME_OT_my_op]
def register():
for cls in classes:
bpy.utils.register_class(cls)
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)
del bpy.types.Scene.my_tool
if name == "main":
register()
but I can't see any texture in my panel?
I'm sure that my image loaded correctly



row.template_ID_preview(data, "image", open="image.open"). Please be more specific what exactly does not work. – brockmann Aug 30 '20 at 08:46row.template_ID_preview(bpy.data, "image", open = "C:/Users/Kamali/Desktop/Test.png")– Seyed Morteza Kamali Aug 30 '20 at 09:06bpy.datahas no property "image" – batFINGER Aug 30 '20 at 12:19NameError: name 'data' is not definedso I changed it tobpy.data. I don't know what is data in his code.I tried pass an Image but didn't work! – Seyed Morteza Kamali Aug 30 '20 at 12:48foo.baruserow.template_ID_preview(foo, "bar")where the property "bar" of objectfoois an image. – batFINGER Aug 30 '20 at 13:16bpy.types.Image. – batFINGER Aug 30 '20 at 15:15ui_template_id: pointer property not found: Image.imageThe object is an image which has no property "image" hence the error. Are you aware of howgetattr(foo, "bar")works. Also See https://blender.stackexchange.com/questions/6173/where-does-console-output-go Finally loading an image in a draw method is not a good idea, this is why your "loaded image" image above is number 67... and counting. – batFINGER Aug 30 '20 at 17:38