goocanvas.Table: segfaults adding group
- From: Alessandro Dentella <sandro e-den it>
- To: goocanvas-list gnome org
- Subject: goocanvas.Table: segfaults adding group
- Date: Mon, 14 Sep 2009 14:50:37 +0200
Hi,
can I add a group as child in a table? the attached code (derived from the
demo) works if I add rectangles and segfaults on Ubuntu 8.04 if I add
groups:
The difference is shown below.
This works:
def create_rect (table, row, column, text, width=None):
item = goocanvas.Rect (parent = table,
width = width or 38,
height = 19,
fill_color = "red")
table.set_child_properties (item,
row = row,
column = column,)
This segfaults on ubuntu 8.04 gocanvas 0.9 (but works on ubuntu 9.04
goocanvas 0.10):
def create_group (table, row, column, text, width=None):
gr = goocanvas.Group(parent=table)
item = goocanvas.Rect (parent = gr,
width = width or 38,
height = 19,
fill_color = "red")
table.set_child_properties (gr,
row = row,
column = column,)
sandro
*:-)
--
Sandro Dentella *:-)
http://sqlkit.argolinux.org SQLkit home page - PyGTK/python/sqlalchemy
import gtk
import goocanvas
def create_group (table, row, column, text, width=None):
gr = goocanvas.Group(parent=table)
item = goocanvas.Rect (parent = gr,
width = width or 38,
height = 19,
fill_color = "red")
table.set_child_properties (gr,
row = row,
column = column,)
def create_rect (table, row, column, text, width=None):
item = goocanvas.Rect (parent = table,
width = width or 38,
height = 19,
fill_color = "red")
table.set_child_properties (item,
row = row,
column = column,)
def create_table (parent, rect=True):
table = goocanvas.Table (parent = parent)
if rect:
create_rect (table, 0, 0, "(0,0)", 100)
create_rect (table, 0, 1, "(1,0)", )
create_rect (table, 1, 0, "(0,1)")
create_rect (table, 1, 1, "(1,1)")
else:
create_group (table, 0, 0, "(0,0)", 100)
create_group (table, 0, 1, "(1,0)", )
create_group (table, 1, 0, "(0,1)")
create_group (table, 1, 1, "(1,1)")
return table
window = gtk.Window (gtk.WINDOW_TOPLEVEL)
window.set_default_size (640, 600)
window.connect ("delete_event", gtk.main_quit)
window.realize()
canvas = goocanvas.Canvas ()
# canvas.flags () & gtk.CAN_FOCUS
# canvas.set_size_request (600, 450)
canvas.set_bounds (0, 0, 600, 450)
window.add (canvas)
root = canvas.get_root_item ()
table = create_table (root, rect=False)
window.show_all()
gtk.main ()
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]