Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
time.sleep(...) problem
#1
This is the idea :
- I show a picture via Tkinter : no problem
- I want the program to wait for e.g. 3 seconds
- and then show the next picture, (and so on like a slide show) I have only 2 pics in this code extract.
Problem: I can show the first picture,
but when i add the sleep funtion and the second picture,
it does not show the first pic any more: just sleeps and shows the second picture? Help?
- I want the first picture to keep showing for 3 secs and then show the next.
img = ImageTk.PhotoImage(PIL.Image.open(p / 'pic.jpeg'))
fotoLabel = Label(tk, bg = 'black', image = img) 
fotoLabel.pack(fill = "both", expand = "yes")

time.sleep(3)

img = ImageTk.PhotoImage(PIL.Image.open(p / 'b.jpg'))
fotoLabel.configure(image = img)

tk.mainloop()
Reply


Messages In This Thread
time.sleep(...) problem - by DPaul - Jan-28-2019, 08:45 AM
RE: time.sleep(...) problem - by Larz60+ - Jan-28-2019, 11:27 AM
RE: time.sleep(...) problem - by DPaul - Jan-28-2019, 11:31 AM
RE: time.sleep(...) problem - by Larz60+ - Jan-28-2019, 11:40 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Need Help with Vehicle Routing Problem with Time Windows (VRPTW) in Python kasper321421312 1 554 Nov-10-2023, 08:19 PM
Last Post: snippsat
  Problem with module time and leap seconds Pedroski55 3 1,237 Oct-07-2022, 11:27 PM
Last Post: Pedroski55
  Use subprocess.Popen and time.sleep chucky831 2 1,944 Aug-11-2022, 07:53 PM
Last Post: carecavoador
  How to immediately kill and restart a thread while using a time.sleep() inside it? philipbergwerf 4 3,521 Feb-07-2022, 04:16 PM
Last Post: Gribouillis
  Time.sleep: stop appending item to the list if time is early quest 0 1,871 Apr-13-2021, 11:44 AM
Last Post: quest
  Can you end the Time.sleep function boier96 9 9,435 Jan-16-2021, 10:09 PM
Last Post: Serafim
  time.sleep mtnwinds 4 2,857 May-21-2020, 10:12 AM
Last Post: Larz60+
  kill thread or process asap, even during time.sleep nanok66 4 2,929 Apr-29-2020, 10:13 AM
Last Post: nanok66
  time.sleep works erratically, a bug in Python? stipcevic 2 3,882 Jan-21-2020, 09:38 PM
Last Post: Marbelous
  Adding Cosinus as utime.sleep variable Kreszy 0 1,710 Sep-19-2019, 04:27 PM
Last Post: Kreszy

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020