davidhalldor
davidhalldor

Reputation: 305

Practical GUI toolkit?

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?

Upvotes: 13

Views: 3319

Answers (11)

user1182000
user1182000

Reputation: 1635

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.

Upvotes: 0

Bryan Oakley
Bryan Oakley

Reputation: 386342

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.

Upvotes: 1

dassouki
dassouki

Reputation: 6366

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.

Upvotes: 2

Emrah Diril
Emrah Diril

Reputation: 1765

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.

Upvotes: 0

dmitry_vk
dmitry_vk

Reputation: 4469

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.

Upvotes: 1

Bryan Oakley
Bryan Oakley

Reputation: 386342

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

Upvotes: 3

PiedPiper
PiedPiper

Reputation: 5785

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.

Upvotes: 20

joel
joel

Reputation: 527

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.

Upvotes: 4

Kekoa
Kekoa

Reputation: 28250

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

Upvotes: 2

Chris Walton
Chris Walton

Reputation: 1346

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.

Upvotes: 1

Charlie Martin
Charlie Martin

Reputation: 112414

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.

Upvotes: 7

Related Questions