faqts : Computers : Programming : Languages : Python : Common Problems

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

4 of 8 people (50%) answered Yes
Recently 1 of 4 people (25%) answered Yes

Entry

Is there a way to conditionally pause a loop until some event (button press) takes place?

Jun 7th, 2000 10:18
unknown unknown, Ken Seehof


Sounds like you need to use threads.  Read about the 'threading' module.

The idea is that you would run your loop in a separate thread from the 
GUI thread.  This has the additional benefit of keeping your GUI running 
while the loop is running.  When you pause, create a lock which gets 
released when the desired event occurs in the GUI thread..