PyGTK is a set of
Python wrappers for the
GTK
GTK (formerly GIMP ToolKit and GTK+) is a free software cross-platform widget toolkit for creating graphical user interfaces (GUIs). It is licensed under the terms of the GNU Lesser General Public License, allowing both Free software, free and ...
graphical user interface
A graphical user interface, or GUI, is a form of user interface that allows user (computing), users to human–computer interaction, interact with electronic devices through Graphics, graphical icon (computing), icons and visual indicators such ...
library
A library is a collection of Book, books, and possibly other Document, materials and Media (communication), media, that is accessible for use by its members and members of allied institutions. Libraries provide physical (hard copies) or electron ...
. PyGTK is
free software
Free software, libre software, libreware sometimes known as freedom-respecting software is computer software distributed open-source license, under terms that allow users to run the software for any purpose as well as to study, change, distribut ...
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, the Python wrappers for
Qt and
wxWidgets
wxWidgets (formerly wxWindows) is a widget toolkit and tools library for creating graphical user interfaces (GUIs) for cross-platform applications. wxWidgets enables a program's GUI code to compile and run on several computer platforms with no s ...
, respectively. Its original author is
GNOME
A gnome () is a mythological creature and diminutive spirit in Renaissance magic and alchemy, introduced by Paracelsus in the 16th century and widely adopted by authors, including those of modern fantasy literature. They are typically depict ...
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, a 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 ...
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" 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
*
BitTorrent
BitTorrent is a Protocol (computing), communication protocol for peer-to-peer file sharing (P2P), which enables users to distribute data and electronic files over the Internet in a Decentralised system, decentralized manner. The protocol is d ...
*
Deluge
A deluge is a large downpour of rain, often a flood.
The Deluge refers to the flood narrative in the biblical book of Genesis.
Deluge or Le Déluge may also refer to:
History
*Deluge (history), the Swedish and Russian invasion of the Polish-L ...
*
Emesene
*
Exaile
*
Flumotion
*
Gajim
*
gDesklets
*
Gedit (for optional Python subsystem and plugins)
*
GIMP
Gimp or GIMP may refer to:
Clothing
* Bondage suit, also called a gimp suit, a type of suit used in BDSM
* Bondage mask, also called a gimp mask, often worn in conjunction with a gimp suit
Embroidery and crafts
* Gimp (thread), an ornamental tr ...
(for optional Python scripts)
*
GNOME Sudoku
*
Gramps
*
Gwibber (microblogging client)
*
Jokosher
*
puddletag
*
PyMusique
*
Pybliographer
*
Tryton
*
ROX Desktop (includes
ROX-Filer)
*
SoundConverter
*
Ubiquity (
Ubuntu
Ubuntu ( ) is a Linux distribution based on Debian and composed primarily of free and open-source software. Developed by the British company Canonical (company), Canonical and a community of contributors under a Meritocracy, meritocratic gover ...
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, free software library providing a portable object system and transparent cross-language interoperability. GObject is designed for use both directly in C (programming language), C programs ...
is an object system used by
GTK
GTK (formerly GIMP ToolKit and GTK+) is a free software cross-platform widget toolkit for creating graphical user interfaces (GUIs). It is licensed under the terms of the GNU Lesser General Public License, allowing both Free software, free and ...
,
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 since ...
,
GIO,
GStreamer
GStreamer is a Pipeline (computing), 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 f ...
and other libraries.
Like the GObject library itself, PyGObject is licensed under the
GNU LGPL, 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.
*
Gramps
*
Meld
*
Pitivi
*
PyChess
*
Quod Libet
See also
*
PyQt (Python wrapper for the Qt toolkit)
*
PySide (Alternative Python wrapper for the Qt toolkit)
*
wxPython (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