Python Sleep Function:

Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Oct 2006
Posts: 2,564
Reputation: mattyd is an unknown quantity at this point 
Solved Threads: 1
Featured Poster
mattyd's Avatar
mattyd mattyd is offline Offline
Posting Maven

Python Sleep Function:

 
0
  #1
Nov 30th, 2006
Hello:

I am trying to use the Python Sleep Function via import time; I get results but not the results I am looking for.

What I am trying to do is rather simple and only for visual effect in a Python GUI: Display GIF --> Sleep (pause) 5-seconds --> Display next GUI --> Repeat. Such as:

.
.
.
 
image3 = "pic1.GIF"
photo3 = PhotoImage(file=image3)
 
time.sleep(5)
 
image4 = "pic2.GIF"
photo4 = PhotoImage(file=image4)
 
.
.
.


What seems to happen is that I do note a pause, in this case roughly 5-seconds, but it happens before the GUI appears at all upon the screen; the canvas should display, then 1-by-1 each GIF should appear 5-seconds apart. Instead the pause occurs approximately 5-seconds after I initiate "RUN" and the entire thing is rendered without pause between GIFs

Any, hints, ideas, or direction would be greatly appreciated.

[** Using Dr.Python]


regards,
sharky_machine
Reply With Quote Quick reply to this message  
Join Date: Sep 2005
Posts: 133
Reputation: mawe is an unknown quantity at this point 
Solved Threads: 58
mawe mawe is offline Offline
Junior Poster

Re: Python Sleep Function:

 
0
  #2
Nov 30th, 2006
Hi!

You are using Tkinter, right? Try this: after the time.sleep(), update the GUI with e.g. root.update() (if root is your main window).
I'm not sure if other GUI's need this too.

Regards, mawe
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 2,564
Reputation: mattyd is an unknown quantity at this point 
Solved Threads: 1
Featured Poster
mattyd's Avatar
mattyd mattyd is offline Offline
Posting Maven

Re: Python Sleep Function:

 
0
  #3
Nov 30th, 2006
Originally Posted by mawe View Post
Hi!

You are using Tkinter, right? Try this: after the time.sleep(), update the GUI with e.g. root.update() (if root is your main window).
I'm not sure if other GUI's need this too.

Regards, mawe
Thank-you for your help-- this worked great.

sharky_machine
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Python Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC