jediborger
July 3rd, 2009, 08:30 AM
I am writing a pygtk program which displays an image in a section. It is a picture directory program, so I have a person's info on the right and I want to display a picture of them on the left.
What I need is a way to have the picture scale to fit the parent widgets size. Currently when I load the pixbuf, it is way too large and takes over the screen. I can manually scale it but that impractical as every image in the database will have different dimensions. I'm hoping somebody out here has found a solution to this, either through a combination of gtk widgets or some little snippet of code that can do this image scaling for me. I would like the image to fill the space given and nothing more and resize itself when the window size has changed. Any ideas?
I have created the gui in glade using gtkbuilder and the image is loaded as a gdk.pixbuf if that helps anyone.
What I need is a way to have the picture scale to fit the parent widgets size. Currently when I load the pixbuf, it is way too large and takes over the screen. I can manually scale it but that impractical as every image in the database will have different dimensions. I'm hoping somebody out here has found a solution to this, either through a combination of gtk widgets or some little snippet of code that can do this image scaling for me. I would like the image to fill the space given and nothing more and resize itself when the window size has changed. Any ideas?
I have created the gui in glade using gtkbuilder and the image is loaded as a gdk.pixbuf if that helps anyone.