views:

608

answers:

5

Quick question. I'm using Linux and I want to try making GUI with Python. I've heard about something like Qt, GTK+ and PyGTK but I don't know what they are exactly and what the difference between them is.

Is there any difference on how they work with different DEs like GNOME, KDE, XFCE etc.? Is there any IDE that allows you to create GUI like Microsoft Studio does (for C#, C, Visual Basic etc.)?

Or should I may use another language than Python to make GUI applications?

+8  A: 

Your first stop should be http://wiki.python.org/moin/GuiProgramming

Some tool-kits integrate better in one environment over the other. For example PyQt, PyKDE (and the brand new PySide will play nicer in a KDE environment, while the GTK versions (including the WX-widgets) will blend better into a GNOME/XFCE desktops.

You should look at the environment you want to target. You can go for basic portable GUI kit, or you can to a deeper integration with tour DE, like use of integrated password manager, and configuration file parsers, that are integrated in a specific DE like KDE or GNOME.

You should also consider the dependency that your selection dictates, and what is come by default with a basic DE. For example, PyKDE in the KDE 3.X branch had a non trivial set of dependencies, while at the 4.X branch the plasma binding made the Python GUI programming dependency less of an issue.

There are several IDE tools, in different levels of completeness and maturity. The best thing is to try one ore more, and see what best fit your needs.

Chen Levy
Wow.. there sure are a lot of frame-works there. How on earth am I supposed to figure out which one is the best one for me?
Baldur
@Baldur, what's your main intended platform? For Gnome, GTK (or wx if you want reasonable cross-platform ability to Windows and to a lesser extent Mac); for KDE or other window managers, Qt (also gives you superb cross-platform ability); for Mac-only, PyObj and Cocoa; for Windows-only, I'd suggest IronPython (and Windows Forms... or whatever else the latest and greatest .NET GUI offering is;-).
Alex Martelli
I guess my main platform would be GNOME, so I should use GTK?Does GTK work with Python or do you have to use PyGTK, I'm kind of confused
Baldur
GTK itself is written in C, so you couldn't use it with Python on its own; you'd need a set of _bindings_, i.e. a library that translates GTK into "Python-ese". PyGTK is that library.
David Zaslavsky
+2  A: 

Each desktop environment uses a specific toolkit to build it's components. For example, KDE uses Qt and GNOME uses Gtk.

Your use of a toolkit will be dependent upon what type of desktop environment you're targeting at, and if you want to target a wide range of desktops then use a toolkit which will work on many desktop environments, like Wx widgets which will work on Linux, Mac OS and Windows. For building simple GUI applications, Tkinter will do.

Technofreak
Does Tkinter work on a lot of DEs? Why does GNOME use Gtk and KDE use Qt when they could both use Wx widgets, seeing how Wx works on almost everything? Is there any difference on how good they are?
Baldur
Because Wx is ugly ;-) Seriously though, I think Qt is hard to beat for the combination of ease of programming and visual appearance. But everyone will have their own opinion.
David Zaslavsky
Some wrote B to be better than A, and some wrote D to be better than both A and B, but as D tried to be "works with everything" it was complex than A and B. At the end, some stuck with A or B, some people liked D, and a few more went ahead and found E to be better than A, B and D. Now you have 4 choices, A B D or E :)
Technofreak
lol fair enough
Baldur
@Technofreak You're right: C is not good. :)
EOL
+2  A: 

I would avoid using another language to make a GUI for Python.

I've had every good luck with wxwidgets, which is the python binding for WX, a cross-platform development system. It's pretty easy to learn and quite powerful. The problem with wxwidgets is that it is not installed by default, so your users will need to install it on every platform that they wish to run your application. Find more information about it at http://wxwidgets.org/.

If you want people to be able to use your program without installing anything else, use Tkinter, the GUI system that comes with Python.

I would avoid the Python bindings for GTK or KDE unless you already know those systems. They also need to be downloaded, and they do not seem to have as much adoption as wxwidgets.

vy32
A: 

Use the glade UI designer and pyGtk bindings... that was my first ever experience with python and there are lots of blog posts and tutorials to help you get started

Jiaaro
A: 

Use PyGTK. As important as the toolkit is its underpinnings, with PyGTK you use GLib as well, with its filesystem abstractions (python module gio) that are very important for the Linux desktop, its high-level cross-desktop functions such as glib.get_user_data_dir() and its other application framework tools, and GObject and its property and signals model.

kaizer.se