I want to write shell script file that has a GUI with multiple input boxes for user entry.
I already tried zenity
. Any ideas or advice would be appreciated.
I want to write shell script file that has a GUI with multiple input boxes for user entry.
I already tried zenity
. Any ideas or advice would be appreciated.
Yad may be useful in this regard, it is a fork of zenity with more features, one of them the ability to create forms.
Here is a very simple example of a form:
The above script will display a form like this:
After you enter your data and click ok or hit enter on the keyboard, the form data will be written to a text file called test.txt, I am using awk to separate the form data which is a string with a pipe as field separator, I believe there is a direct way to get the data without awk but I am no yad expert, please check the project home and ask questions, you may find a more elegant way.
How to get and install yad here:
http://www.webupd8.org/2010/12/yad-zenity-on-steroids-display.html
yad project home:
http://code.google.com/p/yad/
more examples here:
http://technostripe.com/yad-a-fork-of-zenity-with-more-features/
http://code.google.com/p/yad/wiki/Examples
I am late here but this may still be helpful.
xDialog is something similar, here is a search list from freshmeat. tcl/tk is another, popular tool for such jobs.
A poor solution would need the user to fill a list, and finally mark all rows:
I admit, that that's not comfortable.
My response might be late (two years late I think) but since a lot of people still searching for the answer to this same question it might be useful. I also search for a "better than zenity/yad/xdialog" solution and I found two very good programs:
gtkdialog: http://code.google.com/p/gtkdialog/ you can build a complete user interface for bash that keeps running while communicating with your backendscript. It is in active developement and is also used by puppy developers. it's own glade-like language is more powerful than libglade, it can run libglade XML however.
gtkserver: http://www.gtk-server.org/ This one goes even a step further and runs as a coprocess while communicating with your bash script via pipes, messages or TCP-ports. It does not work with a XML-typed description file but with GTK-commands that you invoke from the bash commandline. Very powerful indeed :-)
gtkdialog is not in the repositories anymore but you can fins the latest versions in a PPA (https://launchpad.net/~dnjl/+archive/build/+sourcepub/2986274/+listing-archive-extra)
gtkserver has no PPA or deb AFAIK so this has to be compiled from source.
One solution would to use Zenity, but just display each prompt individually. The first prompt would be for the first field, and then when the user clicks "Ok", you could prompt for the second field.
It sounds like you might be reaching the limits of scripting, and might want to look into developing an application-like interface using something like QT or GTK.
You may want to try CommandUI. It does not require coding.