Cómo dibujar un GdkPixbuf usando GTK3 y PyGObject
Tengo una pequeña aplicación que usa unDrawingArea
dibujar un mapa simple usandoPyGObject
yGTK3
.
Yo carga unPixbuf
utilizando
<code>from gi.repository import Gtk, GdkPixbuf pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size("logo.png", 25, 25) </code>
y luego tratar de dibujarlo en elDrawingArea
señal de evento de sorteo
<code>def draw(self, widget, context): window = widget.get_window() ctx = window.cairo_create() ctx.set_source_pixbuf(pixbuf, 0, 0) </code>
pero me sale el mensaje de error
<code>"AttributeError: 'cairo.Context' object has no attribute 'set_source_pixbuf'" </code>
Si estoy leyendo elGuía de migración de Gtk2 a Gtk3 correctamente, esto debería funcionar. ¿Qué estoy haciendo mal?