View Full Version : UI building with scripting

04 April 2004, 01:35 PM
Hello, I'm starting to do research on a project idea to build a little app in an open source scripting language and it's important that it's cross platform. I'm realizing that it will need more than a web or command line based UI, so I'm looking at TCL/TK and I've just stumbled across Python/wxPython. Can anyone give me some info on the pros and cons of the different scripting languages and their various GUI toolkits. Ideally I would like it to be easily run on Win2k, Linux, and OSX. The GUI doesn't need to leap through fire or anything, as a matter of fact I think the most complex part of it will be a "color picker".

Thanks ...

04 April 2004, 08:27 AM
Use wxPython. In case you want a second opinion, I'll say it again: use wxPython.

If you want reasons to do so, I'll give you a hundred, including ease of use, reliablility, prettiness (wxPython uses native widgets, so it matches the "look" of whatever platform you run it on)

If you want a reason not to, I can only give you one: wxPython is somewhat slower than Tcl/Tk to initialize (at least it is on Linux)

One nice thing about wxPython for a beginner is that the distribution comes with a fantastic demo application that demonstrates every single widget. No searching through monstrous cross-referenced documentation (Tcl/Tk's is particularly bad) to find out how to do something: just copy/paste the code and you're away.

iirc the demo code actually has two different methods of doing a colour picker.

04 April 2004, 09:27 AM
Generally what do you think are the best GUI libraries (C/C++ or otherwise)?

At first glance GTK doesn't look much more than TK which seems a good reason to avoid it.

Lots of people say QT is good. I guess the licensing gets a bit weird if you want to develop on Windows as well as Linux (and Mac?).

How does FLTK compare? I know it was designed by a vfx guy and is C++ based, but not a lot of people seem to use it.

Would you recommend WxWindows for C++ too?

I have been put off win32 as it's Windows specific and looks pretty damn complicated.

Are these the main ones? My GUI experience doesn't really go beyond MEL at the moment so it would be great to know what people actually develop with.


04 April 2004, 09:30 AM
Heh, I was hoping you'd respond playmesumch00ns as I think I've heard you complaining about Tcl/Tk before. Thanks for the advice, because I had started to look deeper into Tcl/Tk and even almost ordered a book but I'll be sure to check out wxPython first now.


[edit] What do you think of Boa Constructor?

04 April 2004, 10:50 AM
I hate feeling like I have to agree with playmesumch00ns on just about everything, but I'm going to have to do just that again....

I've been using wxPython for the past couple of months and the only issue I have with it is the speed it takes to load up in the first place.....

If you know wxPython then wxWindows (uh.. sorry... wxWidgets) will be incredibly simple to pick up - it's the wxWidgets documentation that just has a couple of notes on slight changes for Python

04 April 2004, 05:45 AM
Originally posted by rendermaniac
Generally what do you think are the best GUI libraries (C/C++ or otherwise)?

Qt, FOX, wxWindows (now named wxWidgets), Fltk.

At first glance GTK doesn't look much more than TK which seems a good reason to avoid it.

Yep. GTK's main attraction in that in several linux distributions it comes installed. GTK is also C not C++. There is a C++ binding called GTK--, thou.

Lots of people say QT is good. I guess the licensing gets a bit weird if you want to develop on Windows as well as Linux (and Mac?).

It is not weird, it is just expensive. If you are planning to sell the software, it may be worth it. If not, it most likely isn't.

How does FLTK compare? I know it was designed by a vfx guy and is C++ based, but not a lot of people seem to use it.

It is better as a windows toolkit (together with FOX, they are the fastest toolkits around, and fltk is probably the smallest of all toolkits).
FLTK has the big advantage over others of coming with FLUID, which is a free WYSIWYG UI builder (works for C++, but a python translator is also available).
FLTK does not have any sockets or other stuff like wxWindows. Depending on needs, this is a plus or a minus. FLTK C++ code is a tad messier, but easier to read if you don't like the Microsoft-like notation of wxWindows.
Many people consider Qt and wxWindows application frameworks rather than just graphic toolkits due to their several classes that have little to do with UIs, while FOX, Fltk, Tk, etc. are considered UI toolkits.
FLTK, FOX, Tk and the rest try to keep widgets identical across platforms, unlike wxWindows that uses native widgets. This has benefits and disadvantages.
The main benefit of avoiding native widgets is that you really don't need to test your widgets on other platforms, as you know it will all work and look the same. You also get some benefits as better file requesters, for example, than window's basic file requester and so forth. And you are not hampered by some widget functionality not present in the other OS. Finally, subclassing and extending widgets is much, much, much easier than doing so with native widgets.
The disadvantage is that the widgets may look somewhat out of place with the look and feel of the OS. Tk has its own Tk look, FLTK has an XForms look and FOX has a windows look.
Both FLTK and FOX plan to introduce themes in future versions, so widgets can adopt different looks based on code or OS, but that is likely far away. Qt uses a similar approach and it already emulates the native look and feel of the OS, without relying on OS widgets.

Would you recommend WxWindows for C++ too?

Depends. If you can stand its microsoft-like classes, then perhaps.
I would probably first recommend Qt if you can afford it.
I would then recommend wxWindows above others only if you actually plan to use the additional functionality like sockets and the rest.
If not, I'd stay away from it and use FOX or FLTK. I would probably recommend FLTK over FOX due to fluid, but FOX's online documentation is more thorough and the binding to scripting languages (python, ruby, etc) are better and better supported.

For a more detailed comparison (albeit a tad out of date):

04 April 2004, 08:20 AM
Ah, now we get to the real debate: C++ toolkits!

My thoughts are as follows, it basically depends on what you want to do, as different libraries will serve you better for different projects; so learn all of them!

Please note that my experience of all of these is purely on linux.

Qt -- Qt is available free (very slightly limited), so you can "try it out". I haven't got through the nitty-gritty of the licensing scheme, but if you just want to have a go, it's worth getting a copy and taking a look. Be warned that Qt isn't something you can play with. Out of the lot, it probably feels the most "professional". KDE is built on Qt. However, my own experience of it suggests that it is a right royal pain in the arse. Its whole sockets/signals paradigm seems a very powerful way of messaging, but is generally overkill if all you want to write is "if button A is pressed, do this". I've also found it to be a little sluggish. All in all Qt is the library you'd want to use if you were writing a very large, professional application. The sort of application where you won't mind spending more time writing and debugging the UI than the functional code itself. I don't think I'll ever use Qt for writing the sort of graphics apps I'm interested in, unless it's got a widget I just have to have. One major plus it does have is that it's very, very well-documented.

wxWindows/Widgets -- I have to say I'm a big fan of wxWindows. It's easy to get up and running, relatively unrestrictive, powerful and seems pretty fast. It's got a good selection of widgets and there are plenty more home-brewn ones out there on the internet to find. The coding style is very windows-alike, which can be a good or a bad thing depending on your preference. It's well-supported, pretty well-documented and development on it seems to be moving along at a good pace.

fltk -- For my purposes, probably the best of the bunch. as someone already mentioned, the FLUID UI designer it comes with is excellent for placing buttons and selection widgets and hooking them up to do the things you want. If you want something fast, lightweight and quick to develop with (probably the biggest plus in my book), the fltk should be your weapon of choice. It's missing several more "advanced" widgets, so if you need those, use wxWindows, but for most purposes, fltk will do just fine.

04 April 2004, 10:01 AM
Just for reference, we had a similar debate recently on the Aqsis forums regarding which standard cross platform UI toolkit to use for any GUI based utilities to be used in conjunction with Aqsis.

Our requirements are...

Extremely lightweight, we don't need all the other application framework type functionality, we just need simple light UI's and increasing the size of small tools with unnecessary load would defeat the point.
Cross platform to as many platforms as possible for future proofing.
Preferably with script interfaces with as many scripting languages as possible, but at least Python.

The winner in the poll, and therefore the toolkit we will be using is FLTK. This also happens to be my favourite, it is concise and to the point, no fancy stuff, just easy to use and fast.



04 April 2004, 12:58 PM
Pgregory and/or others, can you speak about the pros/cons of building a GUI utility with wxPython vs. pyFLTK? I want to avoid C/C++ altogether and stick with a scripting language. And it seems at first glance like wxPython is a more active project than pyFLTK.

Oddly enough the utility I want to write is a RIB tickler that would eventually have preferences profiles to simplify working with the specific options for each of the RMan renderers, Aqsis obviously being one of them.

CGTalk Moderation
01 January 2006, 12:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.