Re: Invisible GtkImage



On Thu, Jun 13, 2013 at 6:09 PM, Kip Warner <kip thevertigo com> wrote:

The code mostly works in that I can see that the area the widget is
taking appears to be the correct size as I resize its parent. However,
the actual image pixels do not appear to be painted.


Hi Kip,
After setting the rescaled image, you should probably "Chain Up" to the
default size_allocate method.

I'm not a python expert, but I believe

Gtk.Image.do_size_allocate(self, allocation)

at the end of your override should work. Looking at the implementation, the
allocation needs to be stored in GtkWidget's private structure. Without
chaining up, the allocation is never stored, and thus when on_draw() is
called it is likely making a 0x0 sized Cairo context.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]