RabbieBurns Posted February 26, 2009 Posted February 26, 2009 Ive made a few basic 'frontend' (if you can call them that) bash scripts for some programs that require many -flags where it will prompt for each setting, and then run the program based on the user input. Similar to the oldschool batch files, which any tom dick and pony could make, there wasnt really a GUI equivelent until AutoIT (as far as I know) My question is, is there anything a complete newbie like me can use to make a GUI frontend, that will take the options inserted into fields in a GUI, and then launch an external program populating the various flags with what has been entered into the various boxes in the GUI? Hope this makes sense?/ Cheers RB
powdarrmonkey Posted February 26, 2009 Posted February 26, 2009 Hmm, I don't know if ncurses can do what you're after, it's worth looking at. But I think you'll probably be looking at a more complex language like python and PyGtk, which I think it probably the 'easiest' combination.
box_l Posted February 26, 2009 Posted February 26, 2009 try gambas Gambas - Gambas Almost Means Basic very like visual basic, BoX
localzuk Posted February 26, 2009 Posted February 26, 2009 How about building little C Sharp applications with Mono? C Sharp is an easy language to pick up for things like this I'd say.
dhicks Posted February 26, 2009 Posted February 26, 2009 is there anything a complete newbie like me can use to make a GUI frontend A web page. It's the exact processing model you're after - stick a form on the screen, the user fills it in and hits "submit", the data is sent to a web server and calls the command-line application via system() or whatever. All you need is a small web server to listen out on a port (doesn't have to be port 80). Python has a web server module that lets you write a small web server in about 3 lines of code. -- David Hicks
RabbieBurns Posted February 27, 2009 Author Posted February 27, 2009 A web page. It's the exact processing model you're after - stick a form on the screen, the user fills it in and hits "submit", the data is sent to a web server and calls the command-line application via system() or whatever. All you need is a small web server to listen out on a port (doesn't have to be port 80). Python has a web server module that lets you write a small web server in about 3 lines of code. -- David Hicks I was imagining something that would be distributable, rather than having to have them run a web server seems a bit complicated. Thanks though. building little C Sharp applications with Mono and gambas Im afraid I am going to have to look up as I have no clue. Python again I have not dabbled with. But will give it a look.
Arcath Posted March 2, 2009 Posted March 2, 2009 if your using gnome you could allways use "zenity" your script can bring up a series of simple 1 line input boxes. Zenity examples it basically works by putting "var=$(zenity --entry --text "Does this work")", the users input is now in $var 1
dhicks Posted March 2, 2009 Posted March 2, 2009 I was imagining something that would be distributable, rather than having to have them run a web server seems a bit complicated. No, Python lets you write a web server in a few lines of code, it's the simples thing ever! -- David Hicks 1
Arcath Posted March 2, 2009 Posted March 2, 2009 Is the machine that will be running the bash script a webserver? if it is write a simple PHP page with a form on it, then take the POST data and do this: system("sh /path/to/script/script.sh -flag \"{$_POST['value']}\") not sure if using \" will work, or if {$var['var']} will, but you get the idea
linuxgirlie Posted March 4, 2009 Posted March 4, 2009 Xdialog is a nice simple frontend for bash scripts. Xdialog That is the website, gives you lots of examples so you can copy and paste (just highlight what one you want and the script appears below), its what we use to use before we went web-based and is really simple. Jo 1
Gatt Posted March 4, 2009 Posted March 4, 2009 looking at dialog at the moment for servers without X on them...
RabbieBurns Posted March 4, 2009 Author Posted March 4, 2009 Thanks, looks the business Ill give that a play tonight
vaisarger Posted May 27, 2010 Posted May 27, 2010 Please take a look to my BASH library: EasyBashGUI sites.google.com/site/easybashgui Goal is making very easy bash "GUI" script creation... :-)
webman Posted May 27, 2010 Posted May 27, 2010 Instead of Xdialog, for the console - just use dialog. Make your bash scripts user friendly using - dialog | All about Linux Designing Simple front ends with dialog/Xdialog LG #101
vaisarger Posted May 27, 2010 Posted May 27, 2010 With my library: it's so easy... (easybashgui) You can use indifferently -with same script- dialog, Xdialog, kdialog or zenity. If you want, you can force use one of them, or you can make Easybashgui choose for you. In the latter case, it chooses "dialog" if X is not running, or Xdialog, kdialog and zenity are not present in your system, otherwise it chooses "Xdialog", "kdialog" or "zenity" depending on wich D.E. are running script into ( e.g.: KDE, GNOME, or others... ). Important point is: all is done with same script, and shell scripter has not to worry about everything . Bye
webman Posted May 27, 2010 Posted May 27, 2010 vaisarger Isn't your method overkill (and additional, unnecessary) dependencies if you only want console-based dialogs?
vaisarger Posted May 27, 2010 Posted May 27, 2010 (edited) Well, webman... First of all, my method, even if you want only "dialog mode" boxes, already has an advantage: it simplifies a lot scripter work. An example. This would be command line handling directly "dialog" (from its man page), about a "menu" box: >dialog --menu ... Special options: [--create-rc "Ifile"] Common options: [--aspect ] [--backtitle ] [--beep] [--beep-after] [--begin ] [--cancel-label ] [--clear] [--colors] [--cr-wrap] [--default-item ] [--defaultno] [--exit-label ] [--extra-button] [--extra-label ] [--help-button] [--help-label ] [--help-status] [--ignore] [--input-fd ] [--insecure] [--item-help] [--keep-window] [--max-input ] [--no-cancel] [--no-collapse] [--no-kill] [--no-label ] [--no-shadow] [--ok-label ] [--output-fd ] [--print-maxsize] [--print-size] [--print-version] [--separate-output] [--separate-widget ] [--shadow] [--single-quoted] [--size-err] [--sleep ] [--stderr] [--stdout] [--tab-correct] [--tab-len ] [--timeout ] [--title ] [--trim] [--visit-items] [--version] [--yes-label ] As you see, features are a lot, you have a great control on almost everything, but it's a little bit confusing, at least at beginning. EasyBashGUI, instead, since its goal is simplify scripter's work, would be like so: >export supermode="dialog" && source easybashgui >menu ... ...it's enough. If you want deepest control, maybe EasyBashGUI is not for you; if you want simplicity, maybe EasyBashGUI is useful for your needs. Moreover, you should carefully consider that your script could one day used in a graphical environment. It's not an improbable event. You wrote a program to your geek friend, but now he's asking to you to give a nicer gui; or former intended target user is now no more comfortable with terminal programs, now being an happy KDE user; and so forth... In that way, using my library, >adjust "Please, set Volume" "0" "35" "100" will work exactly the same, with dialog and, in KDE, with kdialog, without any modification. This is, IMO, a priceless potential feature, you should consider it. Edited May 27, 2010 by vaisarger 1
vaisarger Posted May 27, 2010 Posted May 27, 2010 Ahhh... I forgot: Xdialog, kdialog and zenity are NOT easybashgui dependencies... it uses'hem if it find'hem in your system...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now