stretching an image to fill a canvas in tkinter
I have a PhotoImage that I am loading into my cavas using create_image(). I can anchor this image and move it around the canvas, but I can't seem to find a way to stretch it so it fills the canvas.
I can zoom() on the PhotoImage, but this takes an integer zoom coefficent, so if the canvas is much larger than the image I can't fill it exactly.
There must be a way to do this that开发者_如何学JAVA I'm missing?
No, there isn't a way. Tkinter can only scale images by integer factors. Your only solution is to use another library (such as PIL) to resize the image.
精彩评论