Эй, я хочу, чтобы одно и то же изображение выскочило на 4 секунды в другом месте. В этот момент все фотографии сразу появляются. Я пытался добавить time.sleep для for l oop, но все фотографии всплывают сразу любым способом. Пожалуйста, попробуйте мой код и фактически покажите мне, как исправить, так как я очень плохо знаком с python. Спасибо
from tkinter import *
from PIL import ImageTk, Image
from os import walk, getenv, system
from shutil import copyfile
import subprocess
import requests, subprocess, os, tempfile
import os
import tkinter.messagebox
import time
# This is the fuction that makes the original photo and is what root.after calls to later on in the code.
def ShowAnotherWin(i):
win = Toplevel()
image = ImageTk.PhotoImage(Image.open('C:/Users/capture.PNG'))
win.geometry(i)
canvas =Canvas(win, width=420, height=560)
canvas.create_image(0, 0, image= image, anchor=NW)
canvas.pack()
win.overrideredirect(1)
win.mainloop()
# This is the list it, it consists of different y and x interpects point and will be combined with the showanotherwin to makee a unique image pop up.
YourImageList = ['420x544+0+0',
time.sleep(1)
'420x544+200+600',
time.sleep(88)
'420x544+1300+100',
'420x544+1500+800',
'420x544+900+500',
'420x544+500+75',
]
# this code right here takes all the elements in the list and combines it with the showanotherwin. It then displays on screen.
root = Tk()
for i in YourImageList:
root.after(0, lambda i=i: ShowAnotherWin(i))
# time.sleep(1)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> leads to all the photos poping up with the only, effect being the duration of the photos poping up. Please help!!
# this right here is just making another photo by itself dont worry about it.
image = ImageTk.PhotoImage(Image.open('C:/Users/capture.PNG'))
root.geometry('420x544+750+200')
canvas = Canvas(root, width=420, height=560)
canvas.create_image(0, 0, image= image, anchor=NW)
canvas.pack()
root.overrideredirect(1)
root.mainloop()