Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GTK and PYGTK difference

Tags:

many programmers import both gtk and pygtk in this way:

import gtk
import pygtk

I have created a simple program using only gtk and it works:

import gtk

window = gtk.Window()
window.set_size_request(800, 700)
window.set_position(gtk.WIN_POS_CENTER)
window.connect("destroy", gtk.main_quit)

button = gtk.Button("Vai")
button.set_size_request(30, 35)
button.connect("clicked", naviga)
testo = gtk.Entry()

h = gtk.HBox()
h.pack_start(testo)
h.pack_start(button)

window.add(h)
window.show_all()
gtk.main()

So... the question is: what is the difference from GTK and PYGTK ?

like image 992
xRobot Avatar asked Oct 18 '10 16:10

xRobot


People also ask

Is PyGTK Cross platform?

PyGTK is a cross-platform library. It is a free software distributed under the LGPL license.

Is PyGTK free?

PyGTK is free software and licensed under the LGPL. It is analogous to PyQt/PySide and wxPython, the Python wrappers for Qt and wxWidgets, respectively. Its original author is GNOME developer James Henstridge.

What is Python GTK?

GTK is a multi-platform toolkit for creating graphical user interfaces. It is created in C language. GTK has been designed from the ground up to support a range of languages, including Python, Ruby, and Perl. The GTK library is also called the GIMP Toolkit.

What is PyGObject used for?

PyGObject is a Python package which provides bindings for GObject based libraries such as GTK, GStreamer, WebKitGTK, GLib, GIO and many more. It supports Linux, Windows and macOS and works with Python 3.7+ and PyPy3. PyGObject, including this documentation, is licensed under the LGPLv2.


1 Answers

pygtk is provided by python-gobject. gtk is provided by python-gtk2.

pygtk provides the pygtk.require function which allows you to require that a certain version of gtk (or better) is installed. For example

import pygtk
pygtk.require('2.0')

importing gtk only is possible, but your program may not work as expected on someone else's machine if their version of gtk is older.

like image 162
unutbu Avatar answered Sep 29 '22 15:09

unutbu