Creating GUI with Python in Linux

47,407

Solution 1

Your first step 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.

Solution 2

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.

Solution 3

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.

Solution 4

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

Share:
47,407

Related videos on Youtube

Iceland_jack
Author by

Iceland_jack

Updated on January 22, 2020

Comments

  • Iceland_jack
    Iceland_jack almost 4 years

    Quick question.

    I'm using Linux and I want to try making a 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 Visual Studio does (for C#, C, Visual Basic etc.)?

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

  • Iceland_jack
    Iceland_jack about 14 years
    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?
  • Iceland_jack
    Iceland_jack about 14 years
    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?
  • Alex Martelli
    Alex Martelli about 14 years
    @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;-).
  • Iceland_jack
    Iceland_jack about 14 years
    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
  • David Z
    David Z about 14 years
    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 Z
    David Z about 14 years
    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.
  • Parthan
    Parthan about 14 years
    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 :)