def to_gtk_buff(self): """ Converts image to gtkImage and returns it Arguments: - self: The main object pointer. """ img = self.__image if "as_numpy_array" in dir(img): buff = GdkPixbuf.new_from_array(img.as_numpy_array(), GdkPixbuf.Colorspace.RGB, img.depth) else: buff = GdkPixbuf.Pixbuf.new_from_data(img.tostring(), GdkPixbuf.Colorspace.RGB, False, # has alpha channel 8, #depth img.shape[1], #width img.shape[0], #height img.shape[1]*img.shape[2], None, None) return buff