Segfault when subclassing ItemModelSimple
- From: Andrés Ambrois <andresambrois gmail com>
- To: goocanvas-list gnome org
- Subject: Segfault when subclassing ItemModelSimple
- Date: Tue, 16 Feb 2010 00:39:55 -0200
I've been trying unsuccessfully to subclass ItemModelSimple in my application.
But I cannot see what I'm doing wrong.
I've written the code based on the only piece of documentation available on
the matter:
https://bugs.launchpad.net/pygoocanvas/+bug/295952
But I'm still getting a segfault right after calling root.add_child. Here's
the code:
#!/usr/bin/python
import gtk
import goocanvas
from util import ValueSymbol
from models import PointModel
class PointModel(goocanvas.ItemModelSimple, goocanvas.ItemModel):
def __init__(self, point, **props):
super(PointModel, self).__init__(**props)
self.point = point
def do_create_item(self, canvas):
item = goocanvas.Ellipse(center_x = self.point[0],
center_y = self.point[1])
item.set_canvas(canvas)
item.set_model(self)
return item
w = gtk.Window()
canvas = goocanvas.Canvas()
canvas.set_bounds(0,0,400,400)
canvas.set_size_request(400,400)
w.add(canvas)
p = (200,200)
point_model = PointModel(p)
root = goocanvas.GroupModel()
canvas.set_root_item_model(root)
root.add_child(point_model, -1)
w.show_all()
gtk.main()
Any help would be appreciated!
--
-Andrés
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]