[Sugar-devel] Getting a gtk.image from the get_preview function
tomeu at sugarlabs.org
Wed Aug 5 03:03:39 EDT 2009
On Wed, Aug 5, 2009 at 03:06, sumit singh<sumit.coder at gmail.com> wrote:
> Hi all,
> I would like to ask what is the best way to get a gtk.Image from the
> data returned by get_preview function of activity.Activity fn of
> sugar. I want to make an image buttton using this data. Currently, I
> am doing it by saving the data in a temp file using the tempfile
> module of sugar and then by loading the image from this file, however,
> as I will be req to load around 15-20 such images, I can't say how
> fast the process will end into. Is there a faster method?
> For your reference , here is the code of how the journal activity uses
> this data---- http://pastebin.be/20177 , but as I don't want to use
> hippo canvas, so this method won't work. Kindly give your suggestions.
Sorry, didn't remembered that the journal used hippo to display the
previews when I recommended you to look at that.
If you get a cairo surface like the journal does, you can draw it to a
pixmap and then tell a gtk.Image to display it. More details in this
post (disregard the pixbuf stuff):
More information about the Sugar-devel