How to bring an image inside a GUI? Its possible i

2019-06-13 02:35发布

问题:

I am developing my first pretty application in Bashscript, hmm...

So.. I am starting some kind of GUI for it, with zenity on this first try. But I want to bring some visual art inside the GUI, with no function at all, just some visual art. I want the final application to be cross-os executable.

How to just show an image inside a GUI box? (Maybe with just a OK button, or nothing, just show the image for some time).

Any "easy" solution for this? In BashScript or whatever? Any solution, specially in C, or other languages, is highly appreciatted too...

Thanks for your attenttion, have a good day.

I found Glade with gtk, but have to deep in yet. Any other solution?

EDIT:

I want the final application to be cross-os executable.

Hey... Pretty road... I found a crazy guy like me, he wants a GTK GUI with Bashscript! I am not the only crazy dude in the world, lol....

And I want a "easy" solution, just because what I need for my program is really simple, GUI shows image, buttons, and done. Just to clarify.

回答1:

Use the display command in ImageMagick:

$ display img.png

It will show the image in a GUI window.



回答2:

Bash is not a language for writing GUI applications. There are extensions such as dialog, zenity, and others that allow for using a GUI or TUI to accept input for further bash processing, but these things are very limited. You need to pick a toolkit, such as GTK, QT, or wxWidgets. Most high level scripting languages will have bindings for all the GUI toolkits that I have proved examples for (python, ruby, perl).