13

I am thinking about cross-platform with nice programming language bindings (Java, Ruby and Python). What would be the "flattest" learning curve but yet enough powers to perform most of the standard GUI features? What would you guys/gals recommend; FOX, wx, Tk or Qt?

11 Answers 11

20

I would go with Qt. It works on all the major platforms, and it's being continually improved. You can also get started really fast. There are bindings for Java, Ruby and Python.
Plus it's free if you're writing open source programs.

4
  • Plus, it's free if you're writing open source (released as GPL) apps.
    – Matt
    May 8, 2009 at 22:46
  • 5
    its LGPL, so its free regardless of what licence you use for your app.
    – gbjbaanb
    May 8, 2009 at 22:58
  • Qt4 has the best BiDI support if you do need to support RTL scripts. The most flexible, and IMHO the richer.
    – elcuco
    May 8, 2009 at 23:34
  • 3
    @gbjbaanb: Qt itself is LGPL, but the Python bindings are GPL, see article.gmane.org/gmane.comp.python.pyqt-pykde/15551
    – dF.
    May 9, 2009 at 2:16
7

Honestly, I've built things with Tk, wx, and Qt, and I hate them all equally. Qt's visual editor is the least obnoxious of the three I think.

1
  • Most professional Tk programmers I know agree that Tk is so easy to use that a visual editor just gets in the way. Whether that says anything about the relative ease of use of Qt or wx compared to Tk, I don't know. May 8, 2009 at 23:04
4

WX all the way! I am not a GUI expert, designer or a even a "GUI guy", but recently I needed to write a front end for a product config tool (actually it's a collection of tools, but we wanted a single interface to access and run them all).
The tools are all written in Python so naturally I turned to Python for the UI.
I settled on wxPython... one "import wx" and a few tutorials later, I was banging out frames, notebooks and button panels like I knew what I was doing.
I found plenty of examples to help me when I got stuck and the wxPython docs were very useful - although they are just C++ docs, they were still pretty intuitive.
A quick web search will turn up tons of wxPython tutorials to get you started.

I've written and refactored the UI couple times, but I had a clean, working prototype in < 1 day. The tool was cross platform and all the windows and frames matched the native window system (WinXP, Win2K3, Gnome, etc.) - I was definitely impressed. If I ever have to write UIs in any other language I will certainly be looking for a wx implementation.

1
  • 1
    I haven't tried the others but I am going to agree strongly with Joel. Further the documentation with wx is really good. Look at my handle-I started working with Python seriously in October, had limited programming experience outside of SAS and by December I had an application with a well functioning and so far stable GUI.
    – PyNEwbie
    May 9, 2009 at 2:07
3

Tk is still a very viable solution. The learning curve depends a lot on you. Many folks, like myself, can or have learned all the fundamentals of Tcl and Tk in about a day. There are those that still fight the syntax after years of use. It all depends on how good you are at "unlearning" things you've learned with traditional languages like C and Java. If you have any lisp in your background you can probably learn Tcl in a morning.

Another benefit to Tk is the fact it works with Tcl, Perl, Python and Ruby (and others) so you aren't stuck with a particular language. Though, there's no direct port of Tk to Java. Learn it in one language and your knowledge will transfer over pretty easily to other languages. Tk comes out of the box with Tcl and Python so for those languages there is nothing else to install.

I will say, though, after writing several hundred lines of Python/Tkinter code the past few weeks I much, much prefer coding in Tcl when it comes to GUIs, but that's more of a personal thing than anything else.

For more on Tk with Tcl, Ruby and Perl see http://www.tkdocs.com

2
  • wx looks better than Tk for my opinion in for example Mac OS X, since Tk runs on X11. For Ruby it was installed via rubygems and easy to use but it was even easier to start with Tk since it was build into the Mac OS X. I will probably go for wx for either Python or Ruby projects. May 9, 2009 at 0:19
  • 1
    Tk has a carbon port and cocoa is in the works, meaning you you aren't stuck using X11 on the mac unless you want to. Visit the tkdocs.com website to see examples of native widgets on the mac and windows. And Tcl/Tk comes with OSX so you don't need to install anything. May 9, 2009 at 1:48
2

If you're considering Java, SWT is an excellent cross-platform GUI toolkit.

2

I strongly recommend the Rapid GUI Programming python development book. Author's Page.

I recall that Elsevier has released a Python-GUI book book but the link and the name escape me now.

1

I've not worked with Qt, so I can't judge it, but I have worked with wx and it's quite easy to work with and still quite lean. Also, wxWidgets gives you native widgets on every platform, which is a huge advantage (especially for Macs). While the others emulate the look-and-feel of the native platform, wxWidgets directly uses the native widgets which is faster for many situations.

1
  • 1
    Not entirely true -- Tk uses native widgets on platforms that have native widgets (read: Windows and the Mac). There's no emulation, you get the real deal. May 8, 2009 at 23:05
1

I recommend Gtk. It is a nice, cross-platform, good-looking toolkit. It is designed with language bindings in mind and allows create nice language bindings (pygtk, ruby/gtk2, java-gnome, gtk# and more). Gtk+ is quite easy to learn.

1

If Java is your preferred language, consider Groovy. It is a really nice dynamic language that sits on top of Java, and has some really nice features (SwingBuilder) with respect to writing GUIs. If it wasn't for the fact I'm highly productive in Tcl/tk, I think Groovy would be my personal second choice even though I'm not a big fan of Java or Swing per se. Groovy looks to take a lot of the tedium out of both of those.

For more information see GUI Programming with Groovy.

1
  • I find Groovy really interesting and I will definitely check on making Swing GUI's. Many great IDE's got nice Swing tools/addons such as IntelliJ and Eclipse. May 9, 2009 at 0:28
0

I just want to mention that Qt is much much more than just a GUI toolkit. You get so much more with it, all nicely integrated into the framework, that it would be well worth using it if you are considering crossplatform development. The only issue is that if you want to use it via its Python binding PyQt, you'll either have to pay for a PyQt commercial license (expensive) or GPL your code.

1
  • can you define "more". What "more" do you get besides the GUI toolkit? Aug 31, 2010 at 18:23
0

Gtk is a great cross-platform toolkit. Also, the bindings for ruby are all available in a rubygem, so its very easy to install. Gtk is used for many programs like nautilus, and has many, many capibilities. The tradeoff is that Gtk does so much, that its a bit complex.

When I write a gui, I refuse to hand-code every widget, I insist on a graphical environment to build my forms. I think that means using either Glade or QT Creator. I tried QT Creator, and found it to be so slow, that I couldn't use it, So I build my forms with glade.

When you build your forms in glade, the attributes of the form are saved in an XML file which can be read by your language. Many languages have "Gtk::Builder" modules that read the XML files and then use GTK to show the forms onscreen at runtime. So if you use glade, you can use the language of your choice (C java, ruby, python), and you don't need to "hand-code" all your forms.

Given the choice of languages, I'd choose ruby.

In fairness, I haven't tried wxRuby or Tk. But I know I don't want to hand-code GUIs. You can see my work on this at visualruby.net. I've used ruby with glade to create many GUIs.

Not the answer you're looking for? Browse other questions tagged or ask your own question.