Display an image on a GUI


I am a beginner with julia programming. I am building a desktop app for a 3d plant architecture model. I am using Interact and blink. I need to insert images to my app (expl logo). I coudn’t find on the Interact and blink tutorials how to display an image on the ui window. Could someone help me please?

I am also looking for how to load values contained in an input file on the GUI. (link between widget and value in an input file)

Thank you for your help

Hi @Saliha. I don’t fully understand how the package hierarchy works, but I personally have been using Interact.jl to build my Blink “GUIs”. For example, I often use vbox & hbox layout tools provided by Interact.jl to subdivide my Blink window.

I think the following does more-or-less what you are seeking:

using Blink
using Interact
using Images

wnd=Window() #Create Blink window
img = Images.load("images/animage.png")
body!(wnd, vbox(img)) #Add image to the Blink window

Notice how I use the Images package to load a .png file and add it inside my blink window. There are alternatives of course, but I think this is probably one of the most straightforward ways of doing this.

Also note that I added my image (img) inside an Interact vbox() object. That’s because vbox will try to “show()” the image as a MIME("image/png") - and Images.jl defines that method somewhere.

If, on the other had, you tried to add your image (img) directly to the wnd object, you would get an error message because it apparently needs the image to display itself directly as a MIME("text/html"). At the moment, there is no method to draw the loaded image directly as MIME("text/html") - so it is easier to just always stick your image in something like a vbox().

Sorry. I don’t understand this question. Please elaborate.