1

I would like to resize (not automatically) an image, I used .set_size_request but it made no changes.

from gi.repository import Gtk

window = Gtk.Window()
window.set_size_request(320, 240)
window.connect('delete-event', Gtk.main_quit)

box = Gtk.Box(spacing=6)

image = Gtk.Image()
image.set_from_file("C:\\Users\\alimacher\\FF0000.png")
image.set_size_request(400, 400)

box.pack_start(image, False, False, 1)

window.add(box)

window.show_all()
Gtk.main()

And please there is a way to do it without PixBuf ? Thank you.

  • Possible duplicate of [How to set size of a Gtk Image in Python](https://stackoverflow.com/questions/42800482/how-to-set-size-of-a-gtk-image-in-python), [GdkPixbuf.Pixbuf.scale_simple](http://lazka.github.io/pgi-docs/#GdkPixbuf-2.0/classes/Pixbuf.html#GdkPixbuf.Pixbuf.scale_simple) – stovfl Sep 25 '19 at 20:06
  • https://developer.gnome.org/gdk-pixbuf/stable/gdk-pixbuf-Scaling.html \n https://developer.gnome.org/gtk3/stable/GtkImage.html#gtk-image-new-from-pixbuf – Siva Guru Sep 26 '19 at 05:11

0 Answers0