[pygtk] segmentation fault while using pango
Rebecca Rebhuhn-Glanz
rrebhuhnglanz at gmail.com
Thu Jul 31 22:11:52 WST 2008
Hi,
I'm using pygtk to create a drag-and-drop programming language, and am stuck
on getting text to appear in a drawing area. This is the relevant code:
def runProgram(self,widget,data=None):
#get current page's code vbox. read first element, execute. read
next element, execute. (use eval() or exec()).
#add user-defined parameter to do this
for child in data.get_children():
...
elif child.get_name()=="draw":
drawingArea=self.wTree.get_widget("maindrawingarea").window
image=child.get_children()[0].get_child().get_children()[1].get_children()[0]
...
elif image.get_name()=="text":
text=image.get_children()[0].get_child().get_children()[0].get_text()
pangoText=pango.Layout(pango.Context())
pangoText.set_text(text)
point=image.get_children()[0].get_child().get_children()[2]
xcoord=point.get_children()[0].get_children()[0].get_children()[0].get_children()[1].get_value_as_int()
ycoord=point.get_children()[0].get_children()[0].get_children()[0].get_children()[3].get_value_as_int()
drawingArea.draw_layout(gtk.gdk.GC(drawingArea),xcoord,ycoord,pangoText)
I have checked that the values of text (a string), xcoord (an int), and
ycoord (an int) are correct, so the problem is strictly in the last line.
When I try to run the code, I get the following error, and the window
closes:
pyjama.py:723: PangoWarning: pango_font_map_load_fontset: assertion `fontmap
!= NULL' failed
drawingArea.draw_layout(gtk.gdk.GC(drawingArea),xcoord,ycoord,pangoText)
pyjama.py:723: Warning: g_object_get_qdata: assertion `G_IS_OBJECT (object)'
failed
drawingArea.draw_layout(gtk.gdk.GC(drawingArea),xcoord,ycoord,pangoText)
pyjama.py:723: Warning: g_object_set_qdata_full: assertion `G_IS_OBJECT
(object)' failed
drawingArea.draw_layout(gtk.gdk.GC(drawingArea),xcoord,ycoord,pangoText)
pyjama.py:723: PangoWarning: pango_font_map_get_shape_engine_type: assertion
`PANGO_IS_FONT_MAP (fontmap)' failed
drawingArea.draw_layout(gtk.gdk.GC(drawingArea),xcoord,ycoord,pangoText)
pyjama.py:723: Warning: g_quark_from_string: assertion `string != NULL'
failed
drawingArea.draw_layout(gtk.gdk.GC(drawingArea),xcoord,ycoord,pangoText)
Segmentation fault
Does anybody know what I might be doing wrong? If there's another way to do
this without using draw_layout, I would be completely happy to try it that
way. I tried draw_glyphs as well, but couldn't find enough documentation on
pango.font to get it to work.
Thanks,
Rebecca R.G.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20080731/90f92dcd/attachment.htm
More information about the pygtk
mailing list