[cairo] problem refreshing cairo surface

Kalle Vahlman kalle.vahlman at gmail.com
Sat Nov 12 21:47:33 PST 2011


2011/11/12 Zoltán Vörös <zvoros at gmail.com>:
> Hi All,
>
> I believe, this is a trivial problem, but lacking experience, I can't solve
> it, and I was wondering whether someone could lend a hand here. In short, I
> have a python class that just initialises a drawing area, and I would like
> to use it from somewhere else. It looks like this
[snip code]

I don't immediately spot the error, though there is a possible race
condition between configure_event (which is an asynchronous event by
nature) and trying to use the context it creates in on_load(). That
should probably give an error though. Otherwise the principle seems
what is generally used; have a cache of similar surface to update
whenever and invalidate the widget for painting that cache surface
when needed.

But as a general advice, cairo contexes are not meant to be stored for
longer periods. Just create a new one whenever doing rendering. I'm
not sure if that is your problem but you might as well fix that first.

-- 
Kalle Vahlman, zuh at iki.fi
Powered by http://movial.com
Interesting stuff at http://sandbox.movial.com


More information about the cairo mailing list