[Tutor] real time response
alan.gauld at yahoo.co.uk
Wed May 24 04:30:20 EDT 2017
On 23/05/17 21:07, Michael C wrote:
> def do_stuff:
> and then either break or return if condition is met?
> But that just isn't responsive enough. Is there a way to make function
> check for the event every 0.5 seconds without interfering with the
> do_stuff, ie a code that has its' own space?
Yes. What you have just described is called threading. You can
start a separate sub-process running in the background to
"do stuff" while in your main program (thread) you can monitor
the dots. If your condition is met you can close the sub-thread.
Threading is non trivial however and very easy to get wrong.
I suggest you google for some tutorials and maybe watch a
Youtube video or two to get a feel for it.
Author of the Learn to Program web site
Follow my photo-blog on Flickr at:
More information about the Tutor