LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Best/Simplest way to create GUI for linux (https://www.linuxquestions.org/questions/linux-software-2/best-simplest-way-to-create-gui-for-linux-4175575562/)

myewaccc1 03-22-2016 01:41 AM

Best/Simplest way to create GUI for linux
 
Hi,
I need to write a simple application that will run on Linux (not knowing exactly which distribution). I want it to be as native as possible, so the fewer changes i need to make to the end user environment the better (i'd like to avoid 3rd party software installation).

The application will be very simple, which will contain a GUI very similar to an installer (Next, Next , OK, Next, etc'...).
Any recommendation on which language to use? which GUI libs to use?

I am considering using python and tkinter , but that might cause me to have to install/update python on the client. also C++ and QT is another choice i am considering.
Any recommendation?

Michael Uplawski 03-22-2016 02:47 AM

Quote:

Originally Posted by myewaccc1 (Post 5519526)
Hi,
I need to write a simple application that will run on Linux (not knowing exactly which distribution). I want it to be as native as possible, so the fewer changes i need to make to the end user environment the better (i'd like to avoid 3rd party software installation).

If you can write shell scripts, take a look at Zenity and Yad.

Quote:

The application will be very simple, which will contain a GUI very similar to an installer (Next, Next , OK, Next, etc'...).
Any recommendation on which language to use? which GUI libs to use?

I am considering using python and tkinter , but that might cause me to have to install/update python on the client. also C++ and QT is another choice i am considering.
Where you write “simple” for the application, it is not quite clear if the simplicity applies to the user-interface or the underlying application code. As you lay emphasize on the GUI-aspect, I cling to my suggestion of a shell-script that you write against Zenity or Yad. This allows a potential end-user to quickly make her/his own modifications, when necessary. You would concentrate all variable-definitions on top of the script. This is very comfortable.

When you talk about python and C++, you enter another universe. Between tkinter and Qt, you find other frameworks which should be considered, notably gtk2 and gtk3. Also, semi-graphics like with newt or ncurses are a possibility.

If you have experience with Qt, you know how to write a simple interface and the robustness of this framework should make the decision easy. Small projects with Qt are fun to write. Personally I cannot give you more recommendations. Myself I have written some nice GUIs with Ruby/Gtk2 and -3. The Python-bindings should work just as well or even better that in Ruby... But coding C++ with Qt “feels” more natural to me, although (or because) it asks for a more scrupulous project-organization.

Anyway.., I believe that you should try Yad.

OregonJim 03-22-2016 02:56 AM

Quote:

Originally Posted by myewaccc1 (Post 5519526)
,
I want it to be as native as possible, so the fewer changes i need to make to the end user environment the better (i'd like to avoid 3rd party software installation).
[...]
I am considering using python and tkinter , but that might cause me to have to install/update python on the client.

The two statements above are a bit contradictory.

If you want it to be as native as possible, that means packaging your application in a .deb or .rpm file (or similar). That is the "native" way to install applications on Linux. If you do that, there is no need to worry about having to install python, libraries, or other dependencies, as the distribution's package manager will do it for you.

myewaccc1 03-22-2016 04:25 AM

Quote:

Originally Posted by OregonJim (Post 5519557)
The two statements above are a bit contradictory.

If you want it to be as native as possible, that means packaging your application in a .deb or .rpm file (or similar). That is the "native" way to install applications on Linux. If you do that, there is no need to worry about having to install python, libraries, or other dependencies, as the distribution's package manager will do it for you.

Well, just to be clear : the optimal situation will be to give the user a single executable file, which will open up the gui (simple installer like gui - next next next...), and thats it - no installation required.
Also, i cannot count on the user to have an internet connection.

Michael Uplawski 03-22-2016 06:11 AM

PSE comment on the propositions made in this thread (above and below this post) and the way that they correspond or do not correspond to your needs...
Quote:

Originally Posted by myewaccc1 (Post 5519590)
Also, i cannot count on the user to have an internet connection.

:scratch: What? ... erm okay.

BW-userx 03-22-2016 09:40 AM

Quote:

Originally Posted by myewaccc1 (Post 5519590)
Well, just to be clear : the optimal situation will be to give the user a single executable file, which will open up the gui (simple installer like gui - next next next...), and thats it - no installation required.
Also, i cannot count on the user to have an internet connection.

you seem to sound more Windows orientated in doing things. as others have said, deb, rpm, even straight source code using
Code:

./configure
make
make install
--
py.setup
sh myscript.sh
etc..

these are the ways of Linux, unless installing the complete system itself as far as a GUI setup to install applications.

As far as not having internet to get any dependencies that maybe needed to ensure that your program will run. then you'll have to ensure that it is dependent independent, or have all of the dependencies it needs to run bundled into your means of installing said application. and scripted to install them first and in the order they need to be installed as well. before installing your application.

the no installation required, hum java perhaps to just run a program may work. never tried ruining a java program with everything on the usb stick though the environment has to be established first, regardless of what language you use in order for a program to run.

I think you need to shift gears and think LINUX first, then get to understand how things are done with Linux in the we don't use GUI install programs to install programs that do not install but only run, first. Then go from there perhaps.

you might as well as develop a live Linux usb stick with whatever program you want the user to use so he does not have to install anything nor worry about not having internet. Problem solved. but I could be wrong.

schneidz 03-22-2016 09:43 AM

i use zenity whenever i want a quick-and-dirty menu gui.

Michael Uplawski 03-22-2016 01:27 PM

I forgot something. Or rather: Actively ignored Java, Swing and SWT.
  • These GUIs can be part of a single jar-file that may also contain all of the remaining program-code.
  • Execution may be a simple call of the Java executable with the jar-file as argument.
  • The development is not quick, but the result may be dirty.
  • In theory, the program and the GUI can be platform-independent.

For a small application (huge compared to C++, Python, Ruby, Shell-scripting... a bunch of alternatives), Java may be a possible answer. If you are lucky.

If not, the program is not working alike or not at all on all platforms, the user chooses a virtual machine which is accidentally (only) this time not compatible with your choice of code and libraries, something in SWT or Swing has changed or in the Java-standard, which renders your project incompatible with itself (and String an undefined class, remember that one?).

You don't get money for it - don't code Java.

BW-userx 03-22-2016 01:49 PM

why don't you re-summarize what it is you are actually wanting to do because you have been adding to this project one post at a time. gather all of your thoughts on this matter into one sock then write it out in a format that everyone body can understand. Thank you

OregonJim 03-22-2016 01:55 PM

Quote:

Originally Posted by myewaccc1 (Post 5519590)
Well, just to be clear : the optimal situation will be to give the user a single executable file, which will open up the gui (simple installer like gui - next next next...), and thats it - no installation required.
Also, i cannot count on the user to have an internet connection.

Optimal for whom? Most everyone in the Linux world (especially newbies) expects pre-compiled applications to be installed via the package manager these days. Building from source is another story.

Single-file executables have a number of drawbacks. You must statically link all libraries (which makes the application huge), and those libraries won't get security updates the way shared libraries do, risking your users' systems. You can also run into compatibility problems if your program communicates with other programs via an API defined in those libraries.

Of course, you can do it any way you want. I'm just pointing these things out to save you some support headaches. Also, you haven't told us the scope of your application, or who the target audience is. If this is something for just a few friends, you can get away with non-standard methods - but if you intend to release it into the community, it won't fly very far if it's not packaged.

dugan 03-22-2016 10:58 PM

If this is a game then look into mojosetup.

sundialsvcs 03-23-2016 07:11 AM

Google things like "linux kiosk applications." My initial impression of this requirement is that it is a thing which has already been done many times before. You don't have to "start from scratch," frankly, with almost anything these days.

The naturally multi-layered architecture of XOrg/XWindows can be very light-weight: you can have "a windowed graphic presentation" without carrying around the rather-beefy overhead of "a complete desktop/GUI environment." This is ideal for things like kiosks and installers.

Shadow_7 03-28-2016 03:00 AM

Back in the day you could do simple gui stuff with TK/TCL. I remember it being almost a one liner to make a slider to adjust video brightness. Although never really easy on the eyes.

OregonJim 03-28-2016 12:36 PM

Quote:

Originally Posted by Shadow_7 (Post 5522327)
Back in the day you could do simple gui stuff with TK/TCL. I remember it being almost a one liner to make a slider to adjust video brightness. Although never really easy on the eyes.

You can still do it that way, though the 'modern' equivlent is python/tkinter.

Teufel 03-28-2016 12:59 PM

Quote:

Originally Posted by myewaccc1 (Post 5519526)
I need to write a simple application that will run on Linux (not knowing exactly which distribution). I want it to be as native as possible

It rather depends on which DE do you plan to write for, because different DEs has their different libraries that provides GUI elements.

Quote:

Originally Posted by myewaccc1 (Post 5519526)
The application will be very simple, which will contain a GUI very similar to an installer (Next, Next , OK, Next, etc'...).
Any recommendation on which language to use? which GUI libs to use?

In KDE I use shell scripting + standard KDE Dialogs
It's very simple to use, it looks natively and has a lot standard pre-built stuffs.

Take a look:
https://techbase.kde.org/Development...th_KDE_Dialogs


All times are GMT -5. The time now is 06:53 PM.