Skip to content
Advertisement

Trying to resize image on 2nd window of Tkinter GUI

This code will open a main window with an image, then another window with the same image. Is there any way to resize the image to be smaller? (go to # !>>> IMAGE 2 (2nd window))

Here is the code:

JavaScript

Advertisement

Answer

I see Bryan Oakley has already posted an answer your question, but I’ll supplement it with my own, which also fixes several other problems (some related to this) I noticed in your code and shows how to resize the image without using PIL using the subsample() method Bryan mentioned in a comment under your related question that was closed as a duplicate.

You can find some documentation on it, copy(), zoom(), as well as the other methods of the Photoimage class has by using Python’s built-in help system from the Python console: i.e.

JavaScript

It’s also in the source code of course.

Here’s the code in your question code with fixes:

JavaScript

I don’t have your 4 Dry Out Logo.png logo image, but here’s how things looked after clicking the button while running on my system using a substitute image .

screenshot

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement