[cairo] gtk3, cairo, opengl, python2.7

Simon Sapin simon.sapin at exyr.org
Sat Sep 22 07:04:32 PDT 2012


Le 22/09/2012 13:43, Patrick Shirkey a écrit :
> Hi,
>
> Can anyone point me to a simple example for this combination?
>
> gtk3, cairo, opengl, python2.7

Hi,

PyGTK is only for GTK 2, so you need to use PyGObject 3.x for 
introspection for GTK 3:

http://python-gtk-3-tutorial.readthedocs.org/en/latest/index.html

This doc is new, so you may need to fall back on the C docs + a bit of 
guesswork:

http://developer.gnome.org/gtk3/stable/

You may also needs to have introspection files for cairo so that 
PyGObject knows how to create pycairo objects.


I’m not very familiar with GTK (I use Pango and cairo without GTK) but 
apparently the magic function is gdk_cairo_create which returns a cairo 
context:

http://developer.gnome.org/gdk3/stable/gdk3-Cairo-Interaction.html#gdk-cairo-create


As to OpenGL, I’m not sure what you mean. If you only want to draw in 2D 
with cairo, GTK chooses the backend so you don’t need to worry about it. 
For 3D stuff I don’t know.

-- 
Simon Sapin


More information about the cairo mailing list