Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Zooming a tkinter image
I am trying to create a program that can display images, this is going to tie in with some bigger projects in the future so I thought of just making the photo displaying program now to save me having to rewrite all the code, right now I am using the program to display 32x32 sprites but it looks tiny in comparison with my monitor (which is bad) so I wanted a way to zoom them without having to go back into Photoshop to redraw the images.

import tkinter
from tkinter import *
import threading
from threading import Timer

window = Tk()
window.config(bg = "white")

Px = 0
Py = 0
zw = 8
zh = 8
PlayerF1 = PhotoImage(file = "F1.png")
PlayerF2 = PhotoImage(file = "F2.png")
PlayerF3 = PhotoImage(file = "F3.png")
PlayerF1.zoom(zw, zh)
PlayerF2.zoom(zw, zh)
PlayerF3.zoom(zw, zh)
Playerd = Label(window, image = PlayerF1, bg = "white") = 30, y = 30)

def ani():
    def Frame1():
        Playerd.config(image = PlayerF1)
        def Frame2():
            Playerd.config(image = PlayerF2)
            def Frame3():
                Playerd.config(image = PlayerF3)
            t = Timer(0.1, Frame3)
        t = Timer(0.1, Frame2)
    t = Timer(0.1, Frame1)

As you can see, I tried to use .zoom(), but it hasn't actually done anything to the image.

Right now I am also using the program to test if animations would be viable with this kind of code, so, for the most part, you can ignore ani() and its nested defs.

Any help would be greatly appreciated!
you may want to take a look at:
(Nov-09-2019, 03:17 PM)Larz60+ Wrote: you may want to take a look at:

I have seen that post before, it didn't really help that much (at least for me)...

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Scrollable big image in a window (TKinter) Prospekteur 3 133 Sep-14-2020, 03:06 AM
Last Post: Larz60+
  Adding an image to a tkinter window djwilson0495 2 365 Aug-23-2020, 11:07 AM
Last Post: ebolisa
  Create image on a Toplevel using tkinter ViktorWong 3 1,438 Jun-13-2020, 03:21 PM
Last Post: deanhystad
  [Tkinter] Tkinter Logo Image Evil_Patrick 1 490 May-25-2020, 05:12 AM
Last Post: DT2000
  tkinter and image paths menator01 2 337 Apr-14-2020, 08:46 PM
Last Post: menator01
  [Tkinter] Image editor using Tkinter and PIL Raulica 2 1,117 Dec-03-2019, 10:10 PM
Last Post: joe_momma
  Unable to put background image on Tkinter Frame jenkins43 2 4,103 Nov-27-2019, 11:38 AM
Last Post: jenkins43
  Can't load a png image tkinter Pythenx 2 3,751 May-04-2019, 05:43 PM
Last Post: woooee
  how to insert image into Text widget Tkinter atlass218 5 3,978 Apr-17-2019, 05:28 AM
Last Post: atlass218
  How to in PySide/PyQt, zooming in and out UI Vladlen 0 775 Feb-13-2019, 02:11 PM
Last Post: Vladlen

Forum Jump:

Users browsing this thread: 1 Guest(s)