Search code examples
pythongtkgdkgdkpixbufgobject-introspection

pixbuf.subpixbuf alternative in Gtk3


I have a GTK+ 2 application I am porting to GTK+ 3.
I have a function to cut out some part of an image -

scaled_pb = pb.scale_simple(w,h, GdkPixbuf.InterpType.BILINEAR)
scaled_pb = scaled_pb.subpixbuf(abs((width-w)/2),abs((height-h)/2), width, height)

pb is a pixbuf passed to the function. scaled_pb is returned.
So my question is what is the alternative to pb.subpixbuf in GTK3? My app isn't running now and it's telling that Pixbuf object has no subpixbuf property.

Thank you in advance.


Solution

  • What you want is GdkPixbuf.Pixbuf.new_subpixbuf().