Sorry. I've cleaned up the code. <br><br>I am wondering why I can't get back a gtk.Image displaying "hi" when todisk=False on an xo, but can get the "hi" image with todisk=False when in sugar-jhbuild on fedora. (If todisk=True on either platform, I get back the intended Image).
<br><br>Hope that clarifies my confusion some :-)<br><br><div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><span style="font-family: courier new,monospace;">
def createCountdownPng( self ):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> todisk = True
</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> w = 55</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> h = w</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> if (todisk):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> cimg = cairo.ImageSurface(cairo.FORMAT_ARGB32, w, h)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> ctx =
cairo.Context(cimg)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> else:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
pixmap = gtk.gdk.Pixmap(None, w, h, 24)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> ctx = pixmap.cairo_create()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> ctx.rectangle(0, 0, w, h)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> ctx.set_source_rgb(0, 0, 0)
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> ctx.fill()</span><span style="font-family: courier new,monospace;"></span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> pctx = pangocairo.CairoContext(ctx)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">
play = pctx.create_layout()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> font = pango.FontDescription("sans 30")</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> play.set_font_description(font)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> play.set_text( "hi" )
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> dim = play.get_pixel_extents()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
ctx.translate( -dim[0][0], -dim[0][1] )</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> xoff = (w-dim[0][2])/2</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> yoff = (h-dim[0][3])/2</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> ctx.translate( xoff, yoff )
</span> <span style="font-family: courier new,monospace;"></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
pctx.show_layout(play)</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> img = gtk.Image()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> if (todisk):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> path = os.path.join("tmp", "
hi.png")</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><span style="font-family: courier new,monospace;">cimg.dto_png(path)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> numPixbuf = gtk.gdk.pixbuf_new_from_file(path)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
img.set_from_pixbuf( numPixbuf )</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
else:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> img.set_from_pixmap(pixmap, None)</span></blockquote><div><br> </div><br></div><br>