How do you exit from this function? def next_image(): myLabel.config(image=random.choice(monster_images)) # tell tkinter to invoke next_image() again after 200 miliseconds root.after(200, next_image)