#!/usr/bin/env python

import pygtk
pygtk.require('2.0')

import gtk
import gnome.canvas


w = gtk.Window()
w.connect('destroy', lambda w: gtk.main_quit())
c = gnome.canvas.Canvas()
c.set_size_request(200, 200)
w.add(c)

# Code based on Gustavo Carneiro bugzilla comments:
# http://bugzilla.gnome.org/show_bug.cgi?id=136617

# One needs to create a gnome.canvas.PathDef first, like this:
path_def = gnome.canvas.path_def_new([(gnome.canvas.MOVETO_OPEN, 20, 20),
                                      (gnome.canvas.CURVETO, 80, 20,
                                       80, 80, 20, 80)])

# Then we create the item as usual (is this code right?):
item = c.root().add(gnome.canvas.CanvasBpath)

# Instead of using properties (keyword arguments), one has to call the
# set_bpath method:
#     gnome_canvas_item_new(root,
#                           gnome_canvas_bpath_get_type(),
#                           "bpath", path_def,
#                           "outline_color", "blue",
#                           "width_pixels", 3,
#                           NULL));
item.set_bpath(path_def)
item.set_property('outline_color', 'blue')
item.set_property('width_pixels', 3)

w.show_all()
gtk.main()
