Friday, October 24, 2014

Command line to gui.

With Linux does not mean you have to do everything via the command line. For example you might want to import a picture into Tuxpaint. That requires you know what command to use and know where the file to be converted is.

$ tuxpaint-import file2bconverted.ext

Now you could make the program semi gui with using the zenity command.
# Tuxpaint file import catcher
# Assignments
# --------------------------------
szAnswer=$(zenity --file-selection --title="Select a file to convert to tuxpaint")
# Data input
tuxpaint-import $datafile

Once you create the file, you will want to make it executable.

$ chmod +x

From there you could run the program with:

$ ./

or you would get sort of a gui with:

Then you would get the file selector.

You can select the file to convert from there without knowing a bunch of commands to get to where the file is.  Now we can go one step farther and create an icon that can be easily double clicked to execute the shell file. To do that you want to create a launcher. Just right click where you want the launcher to reside such as at the desktop and then click on create launcher.

 You will want to select a name for the launcher and even choose a graphic for the launcher but the most important is to choose the as the file to execute.

Of course, I have already chose the command.

Then finally you have an icon to double click without having to deal with the command line. Tada!

For more information on Zenity:

No comments:

Post a Comment