LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-25-2011, 04:20 PM   #1
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,659

Rep: Reputation: 255Reputation: 255Reputation: 255
Coding platform more universal than GTK?


Hello,

I would like to get similar output, basically GTK based:
http://developer.gnome.org/gtk-tutor...helloworld.png

GTK is indeed cool and relatively simple.
However it is not universal and it requires GCC and pkg-config. I would like a code that does not alter with time, whatever version of gtk, and does not pass by compiling. I know that compiling make the app faster, but however after years, one have to maintain it and I may provide no support for that.

http://developer.gnome.org/gtk-tutorial/2.90/c39.html
is a good example of use of GCC.

What could be an alternative to GTK that results in the same output: http://developer.gnome.org/gtk-tutor...helloworld.png

Thanks a lot for your advice
 
Old 10-25-2011, 04:23 PM   #2
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,659

Original Poster
Rep: Reputation: 255Reputation: 255Reputation: 255
Python ?
http://www.pygtk.org/pygtk2tutorial/...sec-HelloWorld

It is not so simple, and requires quite a lot of lines for few. Isnt there a python gtk frontend to make the form1 in design?
 
Old 10-25-2011, 04:34 PM   #3
SigTerm
Member
 
Registered: Dec 2009
Distribution: Slackware 12.2
Posts: 379

Rep: Reputation: 234Reputation: 234Reputation: 234
Quote:
Originally Posted by Xeratul View Post
Coding platform more universal than GTK?
Qt.

Quote:
Originally Posted by Xeratul View Post
I would like a code that does not alter with time, whatever version of gtk,
You're asking for the impossible. Compilers and toolkits will change, languages will evolve, new tools will appear, old tools will be forgotten and your code will become obsolete/unsupported by newer tools. "It too, will pass". You should get used to the idea.

Quote:
Originally Posted by Xeratul View Post
What could be an alternative to GTK that results in the same output: http://developer.gnome.org/gtk-tutor...helloworld.png
http://doc.qt.nokia.com/4.3/tutorial-t1.html
If by "output" you mean "button", then you can create same thing in pretty much any GUI toolkit in any language. Do a research and pick your poison... err language+toolkit you're most comfortable with.

Last edited by SigTerm; 10-25-2011 at 04:45 PM.
 
Old 10-25-2011, 06:46 PM   #4
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
There are language bindings to most GUI tool-kits for most scripting languages. Pick the combo that you like.

Currently popular scripting languages: Python, Perl, Ruby. Currently popular GUI toolkits: Tk, GTK, Qt. I'm certain there are others in each category.

The choice you make now will have little impact insofar as hedging against obsolescence. Java comes with fairly portable graphics, and might have the longest viable product life, but is compiled.

--- rod.
 
Old 10-25-2011, 09:23 PM   #5
ultagod
LQ Newbie
 
Registered: Dec 2010
Posts: 24

Rep: Reputation: 0
Write a graphical program for freedos. It will basically always work. Just give people a working image.
 
0 members found this post helpful.
Old 10-26-2011, 07:08 AM   #6
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,659

Original Poster
Rep: Reputation: 255Reputation: 255Reputation: 255
Quote:
Originally Posted by ultagod View Post
Write a graphical program for freedos. It will basically always work. Just give people a working image.
qt needs to be installed.

another way would be perl, perlgtk, but perl is also quite particular.

http://gtk2-perl.sourceforge.net/doc...sec-HelloWorld

python is likely not to work with time.
qt remains likely to work with time, but must be installed. so not "universal" (let's say)

and gcc needs compiling

gambas : is simple but needs to be installed

gtk might be more universal, but it is not installed on all machines: the compiling stuffs
you cannot distribute your code, and that it will surely work cuz users will have to compile it..


bash works in any cases and needs no compiling, but bash has no GTK gui
awk and bash are mostly installed on any linux box

don't know ...
 
Old 10-26-2011, 07:54 AM   #7
SigTerm
Member
 
Registered: Dec 2009
Distribution: Slackware 12.2
Posts: 379

Rep: Reputation: 234Reputation: 234Reputation: 234
Quote:
Originally Posted by Xeratul View Post
qt needs to be installed.
GTK also needs to be installed. You do know it is cross-platform, right? However, it is not a standard windows component, and it is not guaranteed to exist on linux system. By the way, you can statically compile QT application (Opera works this way), but you'll have to release it under opensource license (or you could buy commercial qt license, which is expensive), and you'll lose some functionality.

Quote:
Originally Posted by Xeratul View Post
another way would be perl, perlgtk, but perl is also quite particular.

python is likely not to work with time.
Same applies to perl, java, python or any language or toolkit you could possibly think of. They are all optional components that may not be installed.

Quote:
Originally Posted by Xeratul View Post
don't know ...
As I said, you're asking for the impossible. There is NO compiler, NO language, and NO gui toolkit that will work everywhere. Every interpreted language depends on optional component that may not be included. Every library may be missing from the system. And compiled languages requires compatible CPU, specific OS, and certain set of libraries. In the end you can't even be sure that the target system is capable of displaying GUI, since that requires X, which is also optional component that may be missing. Linux system isn't even guaranteed to have a display, mouse or keyboard, by the way.

Your problem does not have a solution.
You should select your target audience and act accordingly. On Windows, distribute dependencies along with application within installer. For linux system with package manager, provide information to package manager so it will be able to download/install missing libraries. For linux systems without package manager, provide instructions for the user - list dependencies, and tell where they can get them.

There's no other solution.

Also, I'd recommend to use toolkit you're most comfortable with instead of the toolkit that is most popular - this way you'll be able to develop application faster and fix bugs faster. It makes sense to use something like QT, because you'll be able to compile single source for multiple systems.

Last edited by SigTerm; 10-26-2011 at 07:57 AM.
 
1 members found this post helpful.
Old 10-26-2011, 10:27 AM   #8
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Quote:
Originally Posted by Xeratul View Post
python is likely not to work with time.
qt remains likely to work with time, but must be installed. so not "universal" (let's say)
Distros with KDE have qt installed. It's not as "universal" as gtk, but it's probably #2.
 
Old 10-27-2011, 10:54 AM   #9
ruario
Senior Member
 
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 2,557

Rep: Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763
Quote:
Originally Posted by SigTerm View Post
By the way, you can statically compile QT application (Opera works this way)
Just a side point (I know it is a off topic) but Opera doesn't work that way. We are not a Qt and have not depended on (or statically compiled in) support for Qt for at least 8 stable releases (maybe more, I'd have to check).

Opera uses its own toolkit but can optionally use Qt libraries or Gtk libraries purely for styling. If they aren't there it will run just fine.

But back to your point, yes it could be done and we did do it once, a long time ago.

P.S. In case it wasn't clear. I work for Opera.

Last edited by ruario; 10-27-2011 at 10:56 AM. Reason: mentioned I am an Opera employee
 
1 members found this post helpful.
Old 10-27-2011, 12:43 PM   #10
SigTerm
Member
 
Registered: Dec 2009
Distribution: Slackware 12.2
Posts: 379

Rep: Reputation: 234Reputation: 234Reputation: 234
//offtopic
Quote:
Originally Posted by ruario View Post
We are not a Qt and have not depended on (or statically compiled in) support for Qt for at least 8 stable releases (maybe more, I'd have to check).
(curious) Was there any particular reason for ditching Qt? I mean - technically, making yet another toolkit is reinventing the bicycle (And if you did it - it might mean you have run into a problem with Qt).
 
Old 10-27-2011, 02:07 PM   #11
ruario
Senior Member
 
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 2,557

Rep: Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763
//offtopic
Quote:
Originally Posted by SigTerm View Post
(curious) Was there any particular reason for ditching Qt? I mean - technically, making yet another toolkit is reinventing the bicycle (And if you did it - it might mean you have run into a problem with Qt).
Have a read of these two comments by a colleague of mine from a couple of years back when were first working on this. Things have moved on a fair bit (and Opera without Gtk or Qt looks a little nicer than in the screen shots) but they should still answer your questions.

EDIT: Before you read, I just want to clear up two things. Peregrine was the code name for the last Qt version of Opera. Evenes was the code name for first that didn't require it.

http://my.opera.com/ruario/blog/show...omment13784341
http://my.opera.com/ruario/blog/show...omment13819151

EDIT: Firefox is not a full Gtk application either. They also use their own toolkit (XUL) and presumably use similar methods to appear to be Gtk native. The extra couple of tricks we have up our sleeves are that Opera can also do Qt/KDE themeing in addition to Gtk and secondly we can run without either of them. This means that Opera will run on a much more stripped down, bare bones system than any of our major competitors.

Last edited by ruario; 10-27-2011 at 02:32 PM. Reason: added some information about Opera code names and compared the situation with other browsers.
 
1 members found this post helpful.
Old 10-27-2011, 02:15 PM   #12
SigTerm
Member
 
Registered: Dec 2009
Distribution: Slackware 12.2
Posts: 379

Rep: Reputation: 234Reputation: 234Reputation: 234
Quote:
Originally Posted by ruario View Post
//offtopic


Have a read of these two comments by a colleague of mine from a couple of years back when were first working on this. Things have moved on a fair bit (and Opera without Gtk or Qt looks a little nicer than in the screen shots) but they should still answer your questions.

http://my.opera.com/ruario/blog/show...omment13784341
http://my.opera.com/ruario/blog/show...omment13819151
Ok, understood: most of features provided by Qt weren't utilized by app, so you decided to remove extra dependency, since there wasn't much of a benefit from it. Well, that makes sense.
 
Old 10-27-2011, 03:08 PM   #13
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,659

Original Poster
Rep: Reputation: 255Reputation: 255Reputation: 255
Quote:
Originally Posted by SigTerm View Post
Ok, understood: most of features provided by Qt weren't utilized by app, so you decided to remove extra dependency, since there wasn't much of a benefit from it. Well, that makes sense.

Well, I still have doubts that QT is nowadays the most found or universal. Actually indeed, there is not so much other choices.

Maybe in few years, a new code will appear, quick compiling, flexibility of compiling or not for distributing, not so much issues with versions and dependencies... - well, as said above, that's impossible. -But why not?

Actually, I always like Borland C and other C. I find it very well built, since so many years. This code is beauty. It is like quantum physics. - Well made, the perfection of matter.
 
Old 10-28-2011, 08:27 AM   #14
SigTerm
Member
 
Registered: Dec 2009
Distribution: Slackware 12.2
Posts: 379

Rep: Reputation: 234Reputation: 234Reputation: 234
Quote:
Originally Posted by Xeratul View Post
Well, I still have doubts that QT is nowadays the most found or universal. Actually indeed, there is not so much other choices.
"most found" != "most universal". With Qt you can deploy to multiple platforms using same source code. That's good enough for me, plus (IMO) their gui classes are mostly "done right".

Quote:
Originally Posted by Xeratul View Post
Maybe in few years, a new code will appear, quick compiling, flexibility of compiling or not for distributing, not so much issues with versions and dependencies... - well, as said above, that's impossible. -But why not?
In a few hundreds or even thousands of years, maybe - to develop something like that and turn it into standard you'll need cooperation of large number of people and companies.
 
Old 10-28-2011, 08:51 AM   #15
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,275

Rep: Reputation: 5342Reputation: 5342Reputation: 5342Reputation: 5342Reputation: 5342Reputation: 5342Reputation: 5342Reputation: 5342Reputation: 5342Reputation: 5342Reputation: 5342
Quote:
Originally Posted by Xeratul View Post
What could be an alternative to GTK that results in the same output: http://developer.gnome.org/gtk-tutor...helloworld.png
Code:
<html>
<head></head>
<body>
<p><button>Hello World</button></p>
<script type="text/javascript">
// event handlers go here
</script>
</body>
</html>
(No, I'm not trying to be a jerk. Write and deploy your app as a hosted web application, and it will have run on more platforms than any desktop app. This is what software-as-a-service is all about).

Of the desktop GUI toolkits, it's impossible to determine which one is the "most universal" or the "most found". However, Swing is a standard part of Java and TKinter (TK) is a standard part of Python.

Rather than trying to determine which platform is the "most universal", you should be doing what everyone else does, which is balancing the factors of which specific platforms you want to support and which toolkit is the most appropriate for the technical needs of the project. Once you do that, you will probably find that Qt comes out quite nicely.

Last edited by dugan; 10-28-2011 at 10:57 PM. Reason: Left out the c.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Lutris: A New Universal Gaming Platform for Linux is in Development LXer Syndicated Linux News 3 01-15-2011 11:24 AM
GTK coding style MTK358 Programming 7 05-21-2010 08:27 PM
GTK colors not universal kahlil88 Linux - Software 0 10-31-2007 10:14 AM
LXer: Eclipse: Empowering the universal platform LXer Syndicated Linux News 0 04-04-2007 07:46 AM
gtk coding... Zerodark Programming 4 08-21-2003 05:49 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration