Results 1 to 5 of 5

Thread: HOWTO: Create a GUI for your Tip using Kommander

  1. #1
    Join Date
    Feb 2006
    Beans
    195

    HOWTO: Create a GUI for your Tip using Kommander

    This HOWTO is for the benefit of the users that don't like using Terminal/Konsole.
    e.g. Windows converts who expect a dialog/GUI for everything
    or for people like your grandma who want things to be as simple as possible.

    However, the target audience of this HOWTO are the developers/contributers of other HOWTOs.

    This will explain in several easy steps how you can package your tip/script into a simple GUI for others to use.
    This is not to say that you shouldn't continue to post in the current style with the commands separated out.
    But to extend what is currently done so that people have the option of the two.

    This tip is based around Kommander and a lot of the information has come from this crash course in using it.

    1. Install Kommander Editor:
    Either via Synaptic or Add Applications
    It might even be installed with KDE by default.

    2. Run Kommander:
    (Ubuntu) Applications > Programming > Kommander Editor
    (Kubuntu) KMenu > Programming > Kommander Editor (Not so sure of this path)

    3. Create a Hello World GUI:
    1. File > New
    2. Tools > Kommander > ExecButton (or click the icon with OK on it in the toolbar)
    3. Click on the form (the main pane on the right)
    4. Type OK in the text property in the left pane
    5. Right Click the OK button you have just created
    6. Select Edit Kommander text
    7. Type echo "Hello World"
    8. File > Save
    9. Open Terminal/Konsole
    10. kmdr-executor test.kmdr
    11. Your GUI pops up, Click OK
    12. Notice how Hello World appears in the terminal


    4. Create Your Own GUI:
    Step 3 should have got you used to the environment.
    Now all you need to do is make the GUI look like you want and paste all your commands that previously had to be type in the terminal into the "Edit Kommander Text" of the OK button (or wherever)

    NB:
    A useful widget is the FileSelector widget.
    If you want to select a file and copy it all you need to do is add a FileSelector then in the Edit Kommander Text of the OK button add
    Code:
    cp "@FileSelector1.text" CopyOfText.txt
    The at-sign (@) is used to mark Kommander's special functions.
    When a script is executed, Kommander first parses it and executes all functions starting with @.
    Many functions return a value, which is then substituted for the original @function text.
    The resulting processed text is then executed as a regular shell script.

    The users of your HOWTO will also have to install Kommander and they run your GUI from the terminal with
    Code:
    kmdr-executor test.kmdr
    I have attached an example of how I took the usplash HOWTO and made it into a simple GUI.
    Right Click the OK button and select "Edit Kommander Text" to compare what I have done to the original usplash HOWTO.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	kommander.png 
Views:	133 
Size:	7.4 KB 
ID:	8899  
    Attached Files Attached Files

  2. #2
    Join Date
    Nov 2005
    Location
    Where do I live
    Beans
    327

    Re: HOWTO: Create a GUI for your Tip using Kommander

    Couldn't this be done with Zenity? It's included by default in Ubuntu (no idea about Kubuntu).

  3. #3
    Join Date
    Feb 2006
    Beans
    195

    Re: HOWTO: Create a GUI for your Tip using Kommander

    As far as I am aware Zenity doesn't have an IDE that lets you drag and drop controls so that you can easily design your dialog.

    This screenshot of Kommanders IDE shows how easy it is to create complex dialogs

  4. #4
    Join Date
    Dec 2009
    Beans
    Hidden!

    Re: HOWTO: Create a GUI for your Tip using Kommander

    when i click the "ok" button i created as directed above i get the error message

    "Error in widget ExecButton1:
    Line 1: in function 'echo': too few parameters. "

    How do i fix this?

  5. #5
    Join Date
    Dec 2009
    Beans
    Hidden!

    Re: HOWTO: Create a GUI for your Tip using Kommander

    Quote Originally Posted by d3v1150m471c View Post
    when i click the "ok" button i created as directed above i get the error message

    "Error in widget ExecButton1:
    Line 1: in function 'echo': too few parameters. "

    How do i fix this?
    Update:

    needs to be-
    Code:
    #!/bin/bash
    echo "hello world"

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •