How to create something like Picture Box in the UI using Python Script?

Hello! The image below is just photoshopped, it’s not real, I want to create something like PictureBox in a panel using Python Script, I want to use OpenGL, I want that if I collapse the panel named “My Panel” then the PictureBox is hidden with it. I’m sorry, I don’t know how to call it, in Visual Studio, we call it PictureBox.

I can make very complex programming but the problem is how to get the knowledge, and the tutorials? They are very difficult to be found.

How to create it, the title? Thanks.

1 Like

I’m back, I found the function “template_preview”, it’s not interesting because as you see in the image below, the image is tiled, there are 2 houses in the same canvas and I absolutely don’t want that, no, no, no …

I want to say that thanks to the “Edit Source” in the right click menu in old Blender 2.79, I could find that function “template_preview”. So, the new question is: “Do you know any Addon with the Picture Box I was talking about in first post?”, that’s all I want, I will view its Source Code.

New question: “Do you know any Addon with Picture Box please? You don’t need to write code, but if you can, then you can write”.
Or just tell me the name of the function of the Picture Box, that’s all. Thanks.

Did you finally find any solution? Can you show me the code of your example with the two houses? If you still have it…

you can use custom icon and show it with (support transparency)

layout.template_icon(custom_icon.icon_id, scale=10.0)

or current image in blend file

layout.template_icon(["image_name.png"].preview.icon_id, scale=10.0)

but take few second to show

I already use this way. But if I try to enlarge the image to it’s real size looks pixelated!!!