PyGTK is a set of
Python wrappers for the
GTK graphical user interface
The GUI ( "UI" by itself is still usually pronounced . or ), graphical user interface, is a form of user interface that allows users to interact with electronic devices through graphical icons and audio indicator such as primary notation, ins ...
library
A library is a collection of materials, books or media that are accessible for use and not just for display purposes. A library provides physical (hard copies) or digital access (soft copies) materials, and may be a physical location or a vi ...
. PyGTK is
free software
Free software or libre software is computer software distributed under terms that allow users to run the software for any purpose as well as to study, change, and distribute it and any adapted versions. Free software is a matter of liberty, n ...
and licensed under the
LGPL
The GNU Lesser General Public License (LGPL) is a free-software license published by the Free Software Foundation (FSF). The license allows developers and companies to use and integrate a software component released under the LGPL into their own ...
. It is analogous to
PyQt/
PySide and
wxPython
wxPython is a wrapper for the cross-platform GUI API (often referred to as a "toolkit") wxWidgets (which is written in C++) for the Python programming language. It is one of the alternatives to Tkinter. It is implemented as a Python extensio ...
, the Python wrappers for
Qt and
wxWidgets, respectively. Its original author is
GNOME
A gnome is a mythological creature and diminutive spirit in Renaissance magic and alchemy, first introduced by Paracelsus in the 16th century and later adopted by more recent authors including those of modern fantasy literature. Its characte ...
developer James Henstridge. There are six people in the core development team, with various other people who have submitted patches and bug reports. PyGTK has been selected as the environment of choice for applications running on
One Laptop Per Child systems.
PyGTK will be phased out with the transition to GTK version 3 and be replaced with PyGObject, which uses
GObject Introspection to generate bindings for Python and other languages on the fly. This is expected to eliminate the delay between GTK updates and corresponding
language binding
In programming and software design, binding is an application programming interface (API) that provides glue code specifically made to allow a programming language to use a foreign library or operating system service (one that is not native to th ...
updates, as well as reduce maintenance burden on the developers.
Syntax
The Python code below will produce a 200x200 pixel window with the words "
Hello World
''Hello'' is a salutation or greeting in the English language. It is first attested in writing from 1826. Early uses
''Hello'', with that spelling, was used in publications in the U.S. as early as the 18 October 1826 edition of the '' Norwich ...
" inside.
import gtk
def create_window():
window = gtk.Window()
window.set_default_size(200, 200)
window.connect("destroy", gtk.main_quit)
label = gtk.Label("Hello World")
window.add(label)
label.show()
window.show()
create_window()
gtk.main()
Notable applications that have used PyGTK
PyGTK has been used in a number of notable applications, some examples:
*
Anaconda installer
Anaconda is a free and open-source system installer for Linux distributions.
Anaconda is used by Red Hat Enterprise Linux, Oracle Linux, Scientific Linux, AlmaLinux, CentOS, MIRACLE LINUX, Qubes OS, Fedora, Sabayon Linux and BLAG Linux and GN ...
*
BitTorrent
*
Deluge
*
Emesene
*
Exaile
*
Flumotion
*
Gajim
*
gDesklets
gDesklets is a GNOME program which provides the architecture for small applets (desktop widgets) to be placed on top of the user's desktop. It is comparable to other desktop widget programs. The applets placed on the desktop are meant to be qui ...
*
Gedit (for optional Python subsystem and plugins)
*
GIMP
GIMP ( ; GNU Image Manipulation Program) is a free and open-source raster graphics editor used for image manipulation (retouching) and image editing, free-form drawing, transcoding between different image file formats, and more specialized ...
(for optional Python scripts)
*
GNOME Sudoku
*
Gramps
*
Gwibber (microblogging client)
*
Jokosher
Jokosher is a free software, non-linear multi-track digital audio editor, released under the GPL-2.0-only. It is written in Python, using the GTK+ interface and GStreamer as an audio back-end, initially just for the Linux operating system but ...
*
puddletag
*
PyMusique
SharpMusique was a rewrite in C# of PyMusique (written in Python), both programs were iTunes Music Store clients, allowing songs to be downloaded from the iTunes Music Store without DRM.
PyMusique
PyMusique was written by Travis Watkins, Cody B ...
*
Pybliographer
*
Tryton
''Tryton'' is a three-tier high-level general purpose computer application platform on top of which is built an Enterprise resource planning (ERP) business solution through a set of Tryton modules.
The three-tier architecture consists of the T ...
*
ROX Desktop
The ROX Desktop is a graphical desktop environment for the X Window System. It is based on the ROX-Filer which is a drag and drop spatial file manager. It is free software released under the GNU General Public License. The environment was i ...
(includes
ROX-Filer
The ROX Desktop is a graphical desktop environment for the X Window System. It is based on the ROX-Filer which is a drag and drop spatial file manager. It is free software released under the GNU General Public License. The environment was ...
)
*
SoundConverter
*
Ubiquity (
Ubuntu
Ubuntu ( ) is a Linux distribution based on Debian and composed mostly of free and open-source software. Ubuntu is officially released in three editions: '' Desktop'', ''Server'', and ''Core'' for Internet of things devices and robots. All ...
installer)
*
Ubuntu Software Center
*
Wing IDE
* Comix
PyGObject
PyGObject provides a wrapper for use in Python programs when accessing GObject libraries.
GObject
The GLib Object System, or GObject, is a free software library providing a portable object system and transparent cross-language interoperability. GObject is designed for use both directly in C programs to provide object-oriented C-based APIs ...
is an object system used by
GTK,
GLib
GLib is a bundle of three (formerly five) low-level system libraries written in C and developed mainly by GNOME. GLib's code was separated from GTK, so it can be used by software other than GNOME and has been developed in parallel ever s ...
,
GObject
The GLib Object System, or GObject, is a free software library providing a portable object system and transparent cross-language interoperability. GObject is designed for use both directly in C programs to provide object-oriented C-based APIs ...
,
GIO
Gio or GIO may refer to:
People
* Gio (nickname)
* Gio (footballer, born 1984), Spanish
* Gio (singer) (born 1990)
* Gio people, an ethnic group in northeastern Liberia and Côte d'Ivoire
Science and technology
* Gi/o, protein subunits
* GI ...
,
GStreamer
GStreamer is a pipeline-based multimedia framework that links together a wide variety of media processing systems to complete complex workflows. For instance, GStreamer can be used to build a system that reads files in one format, processes the ...
and other libraries.
Like the GObject library itself, PyGObject is licensed under the
GNU LGPL
The GNU Lesser General Public License (LGPL) is a free-software license published by the Free Software Foundation (FSF). The license allows developers and companies to use and integrate a software component released under the LGPL into their own ...
, so it is suitable for use in both free software and proprietary applications. It is already in use in many applications ranging from small single-purpose scripts to large full-featured applications.
PyGObject can dynamically access any GObject libraries that use
GObject Introspection. It replaces the need for separate modules such as PyGTK, GIO and python-gnome to build a full GNOME 3.0 application. Once new functionality is added to GObject library it is instantly available as a Python API without the need for intermediate Python glue.
Notable applications that use PyGObject
PyGObject has replaced PyGTK, but it has taken a considerable amount of time for many programs to be ported. Most of the software listed here has an older version which used PyGTK.
*
Ex Falso
*
Gramps
*
Meld
*
Pitivi
*
PyChess
''PyChess'' is a free software chess client developed for GNU. It allows users to play offline or online via the Free Internet Chess Server (FICS). PyChess also incorporates a built-in chess engine, which in contrast to most other chess AIs is wr ...
*
Quod Libet
See also
*
PyQt (Python wrapper for the Qt toolkit)
*
PySide (Alternative Python wrapper for the Qt toolkit)
*
wxPython
wxPython is a wrapper for the cross-platform GUI API (often referred to as a "toolkit") wxWidgets (which is written in C++) for the Python programming language. It is one of the alternatives to Tkinter. It is implemented as a Python extensio ...
(Python wrapper for the wx widgets collection)
References
External links
PyGTK HomepagePyGTK FAQPyGTK Notebook A Journey Through Python Gnome Technologies by Peter GillPyGTK at Python wikiPyGObject Homepage
{{Widget toolkits
GTK language bindings
Python (programming language) libraries
Software that uses PyGObject
Software that uses PyGTK
Widget toolkits