analitics

Pages

Showing posts with label pygtk. Show all posts
Showing posts with label pygtk. Show all posts

Saturday, December 10, 2016

The python modules pygobject, pycairo and pygtk under Windows OS.

I used the python version 2.7 32 bits under .
C:\Python27>python
Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:19:22) [MSC v.1500 32 bit (
Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

The issue is to instal PyGTK python module but you can see I got errors.
C:\>cd Python27

C:\Python27>cd script
The system cannot find the path specified.

C:\Python27>cd Scripts

C:\Python27\Scripts>pip install PyGTK
Collecting PyGTK
Downloading pygtk-2.24.0.tar.bz2 (2.4MB)
100% |################################| 2.4MB 224kB/s
Complete output from command python setup.py egg_info:
ERROR: Could not import dsextras module: Make sure you have installed pygobj
ect.

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\my_account
\appdata\local\temp\pip-build-os60hf\PyGTK\

C:\Python27\Scripts>pip install pygobject
Collecting pygobject
Downloading pygobject-2.28.3.tar.bz2 (889kB)
100% |################################| 890kB 550kB/s
Complete output from command python setup.py egg_info:
ERROR: Could not find pkg-config: Please check your PATH environment variabl
e.

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\my_account
\appdata\local\temp\pip-build-lt0gbh\pygobject\

I got the pygobject-2.28.3.win32-py2.7.msi, pycairo-1.8.10.win32-py2.7.msi and pygtk-2.24.0.win32-py2.7.msi from gnome website.
I install this python modules using registry and this option: Python from another location and I set my python path: C:\Python27\
>>> import gobject
>>> dir(gobject)
['GBoxed', 'GEnum', 'GError', 'GFlags', 'GInterface', 'GObject', 'GObjectMeta',
...
>>> import cairo
>>> dir(cairo)
['ANTIALIAS_DEFAULT', 'ANTIALIAS_GRAY', 'ANTIALIAS_NONE', 'ANTIALIAS_SUBPIXEL',
>>> import pygtk
>>> dir(pygtk)
['__all__', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '_
get_available_versions', '_our_dir', '_pygtk_2_0_dir', '_pygtk_dir_pat', '_pygtk
_required_version', 'fnmatch', 'glob', 'os', 'require', 'require20', 'sys']


As you can see this python modules works well.


Tuesday, July 30, 2013

The new pygobject come with version 3.9.5 .

GObject is a object system used by GTK+, GStreamer and other libraries.

The new PyGObject 3.9.5 provides a convenient wrapper for use in Python programs when
accessing GObject libraries.

The news come from Simon Feltman - pygtk digest: I am pleased to announce version 3.9.5 of the Python bindings for
GObject. This is the third release of the 3.9.x series which will
eventually result in the stable 3.10 release for GNOME 3.10.

The new release is available from ftp.gnome.org.

Thursday, August 11, 2011

How to make working pygtk with python 2.7

As you know, PyGTK is a module that allows us to use the GTK interface.
A good start to use this module:
Articles
I do not know if I presented this module on the site, but now I will try to present it.
First, as it says on the official site:
"PyGTK lets you easily create applications with a graphical user interface Using the Python programming language."
The second time is easy to use because we can easily create interfaces using Glade.
Glade is a RAD tool.
This development tool to let us create user interfaces for the GTK + toolkit and the GNOME desktop environment.
The output is an xml file which is then used by PyGTK.
Read more on the official site: Glade RAD tool.
The tricky part is connecting with the python source code from the XML components.
You can download it here and install version 2.22 on Windows from here.
I use pygtk-all-in-one-2.22.6.win32-py2.7.msi to test pygtk.
Also, you need GTK 2.22 from here.
How to make working Python 2.7 with GTK?
Just right-click on My Computer, then select Properties.
Click the Advanced tab in the dialog that pops up, and click the Environment Variables button near the bottom.
Under System variables, click the New button and enter GTK_BASEPATH.
Now under variable named Path, and click the Edit button and add GTK_BASEPATH\bin;.
Click the OK buttons restart Windows XP.
Now it is working fine with Python 2.7.
Let's try this script:
#!/usr/bin/env python
import sys

try:
    import pygtk
    pygtk.require("2.0")
    print "pygtk 2.0 ok!"
except:
    print "pygtk 2.0 BAD!"
    pass
    
try:
    import gtk
    print "gtk ok!"
except:
    print "gtk BAD!"
    pass

Sunday, June 21, 2009

PyGTK and GdkPixbuf

What is GdkPixbuf?
* An object holding information about images in memory.
Constructor
GdkPixbuf (GdkColorspace colorspace, bool has_alpha, int bits_per_sample, int width, int height);

Example:

>>> import pygtk
>>> import pygtk
>>> pixbuf = gtk.gdk.Pixbuf( gtk.gdk.COLORSPACE_RGB, False,8, 200, 100)
>>> pixbuf.save('/home/net/cc/a.jpg','jpeg', {'quality':'100'})

The output is :

PyGTK 2.15.2 - unstable

As you know, PyGTK is a set of Python wrappers.
Now PyGTK easily create programs with a graphical user interface using the Python programming language.
The new PyGTK version 2.15.2 and is on PyGTK 2.15.2 source.
From http://pygtk.org
"What's new since 2.15.0?
- (Add HSV support to gtk.gdk.Color objects)
- Add floating-point support to gtk.gdk.Color (Paul)
- Retire hand-written ChangeLog; autocreate from Git history (Paul)
- Fix conditional in docs/Makefile.am (Frederic Peters)
- Document that gtk.gdk.GC coordinates are not related to allocation (Paul)
- Make pygtk_boxed_unref_shared() also handle Py_None (Paul)
- Make gtk.MenuItem.set_submenu accept None (Paul)
- Don't run 'fixxref.py' if documentation is not built (Björn Lindqvist)
- Apply libtool 2.2 compatibility patch (Gian)
- Plug reference leak on main signal watch source (Paul)
- Add extra warning against accidental misuse of tree model columns (Paul)
- Wrap gtk.Border attributes and constructor (Mariano Suárez-Alvarez)
- Make gtk.gdk.Event.time accept 'long' in assignments (Paul)
- Wrap gtk.RcStyle attributes (Paul)

PyGTK requires GTK+ >= 2.8.0 and Python >= 2.3.5 to build."