My problem consists in that I have replaced a GtkImage for a GtkDrawingArea widget and it's not scrolling like it happens with the GtkImage.
This is how I place both my GtkImage and GtkDrawingArea (one at a time).
I thought this would have been enough.
With the GtkImage: I scroll horizontally and vertically and the GtkImageViewport loads the part of the PixBuf that should be displayed, as you can see here:
With the GtkDrawingArea: the scroll bars occupy all the available area, so the image won't move, as you can see here:
If I resize the window, the portion of the image that is not visible and should be visible when scrolling appears:
NOTE1: I want to be able to draw on the image and work with the pixels coordinates, that's why I think using Gtk.DrawingArea and Cairo was a good idea.
NOTE2: I've tried both through Glade, and through code using scrolledwindow.add_with_viewport(drawing_area)
As Nico238 suggested out, I was not explicitly requesting the area for the DrawingArea. I set now the DrawingArea dimensions based on the image I'm drawing.
''' 'draw' callback method. '''
def __on_draw_drawing_area(self, widget, cairo_context):
if len(self.__store) > 0:
# The PixBuf to draw
image = self.__store_dictionary[self.__active_sample_id]['displayed_image']
# This was the missing line.
self.__w_drawing_area.set_size_request(image.get_width(), image.get_height())
# Add the image to the Cairo context and draw
Gdk.cairo_set_source_pixbuf(cairo_context, image, 0, 0)
cairo_context.paint()