Q: can you do other tasks in python while using time.sleep()? I am trying to write a program that uses time.sleep()
I want to start the program and have an item continuously moving(this part I have sorted).
I then want the program to 'sleep' for a specified time period (either 1, 2, 5, 10 minutes)
During this 'sleep' time, if someone pushes a button connected to the equipment, then everything stops moving.
If they push the button after the specified time, then everything works well.
Is it possible to have this happen with time.sleep() or is there an alternative, better way?

A: You don't need time.sleep(), and you don't need a tight loop (or any sort of loop) to check against the clock. All you need to do is set a flag at the start, then use the after message to clear the flag after the desired time. Then, you button function merely needs to check the flag to see if it's OK to do whatever it needs to do.
For example:
...
b = tk.Button(..., command=self.pause)
def pause(self):
    if self.is_sleeping:
        self.pause()
...
self.is_sleeping = True
self.after(sleep_period, lambda: self.is_sleeping = False)
self.start_animation()


A: Don't use sleep - it is useless. 
You can use clock and check if it is time to do some things - it is not ideal.
Not ideal pseudo code:
time_to_wake_up = current_time + 10 minutes
pause = False # move objects

while True:

     if time_to_wake_up > current_time:

           if button_was_press:
                 if not pause:
                       pause = True
                       time_to_next_button_press = current_time + 2 minutes
                 else current_time > time_to_next_button_press:
                       pause = False

     check_events_and_run_other_stuff

     if not pause:
            change_objects_position
            draw_everything

You have main loop to do all stuff and you decide what should be done at current moment.
It is not ideal - maybe there are better solution.
