PyGTK is a set of
Python wrappers for the
GTK
GTK (formerly GIMP ToolKit and GTK+) is a free and open-source 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 and prop ...
graphical user interface
The GUI ( "UI" by itself is still usually pronounced . or ), graphical user interface, is a form of user interface that allows User (computing), users to Human–computer interaction, interact with electronic devices through graphical icon (comp ...
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, ...
and licensed under the
LGPL. It is analogous to
PyQt
PyQt is a Python (programming language), Python Language binding, binding of the cross-platform GUI toolkit Qt (toolkit), Qt, implemented as a Python Plug-in (computing), plug-in. PyQt is free software developed by the United Kingdom, British firm ...
/
PySide
PySide is a Python (programming language), Python Language binding, binding of the cross-platform Graphical user interface, GUI toolkit Qt (framework), Qt developed by The Qt Company, as part of the Qt for Python project. It is one of the List of w ...
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 extension ...
, 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 min ...
, respectively. Its original author is
GNOME 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 ...
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
*
BitTorrent
*
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 may also refer to:
History
*Deluge (history), the Swedish and Russian invasion of the Polish-Lithuanian Comm ...
*
Emesene
*
Exaile
Exaile is a cross-platform free and open-source audio player, tag editor and library organizer. It was originally conceived to be similar in style and functions to KDE's Amarok 1.4, but uses the GTK widget toolkit rather than Qt. It is wri ...
*
Flumotion
*
Gajim
Gajim is an instant messaging client for the XMPP protocol which uses the GTK toolkit. The name Gajim is a recursive acronym for ''Gajim's a jabber instant messenger''. Gajim runs on Linux, BSD, macOS, and Microsoft Windows. Released under the ...
*
gDesklets
*
Gedit
gedit ( or ) is a text editor designed for the GNOME desktop environment. It was GNOME's default text editor and part of the GNOME Core Applications until GNOME version 42 in March 2022, which changed the default text editor to GNOME Tex ...
(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
*
puddletag
*
PyMusique
*
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 Tr ...
*
ROX Desktop (includes
ROX-Filer)
*
SoundConverter
*
Ubiquity
Ubiquity is a synonym for omnipresence, the property of being present everywhere.
Ubiquity may also refer to:
* Ubiquity (software), a simple graphical installer made for the Ubuntu operating system
* Ubiquity (Firefox), an experimental extens ...
(
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 th ...
installer)
*
Ubuntu Software Center
Ubuntu Software Center, or simply Software Center, is a discontinued high-level graphical front end for the APT/dpkg package management system. It is free software written in Python, PyGTK/ PyGObject based on GTK.
The program was created for ...
*
Wing IDE
The Wing Python IDE family of integrated development environments (IDEs) from Wingware was created specifically for the Python programming language, with support for editing, testing, debugging, inspecting/browsing, and error checking Python c ...
* 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
GTK (formerly GIMP ToolKit and GTK+) is a free and open-source 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 and prop ...
,
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 si ...
,
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,
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, 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
*
Quod Libet
A quodlibet (; Latin for "whatever you wish" from '' quod'', "what" and '' libet'', "pleases") is a musical composition that combines several different melodies—usually popular tunes—in counterpoint, and often in a light-hearted, humorous ma ...
See also
*
PyQt
PyQt is a Python (programming language), Python Language binding, binding of the cross-platform GUI toolkit Qt (toolkit), Qt, implemented as a Python Plug-in (computing), plug-in. PyQt is free software developed by the United Kingdom, British firm ...
(Python wrapper for the Qt toolkit)
*
PySide
PySide is a Python (programming language), Python Language binding, binding of the cross-platform Graphical user interface, GUI toolkit Qt (framework), Qt developed by The Qt Company, as part of the Qt for Python project. It is one of the List of w ...
(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 extension ...
(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