title: How to display images in sequence one after another in same window location in Python?
body: <p>I have 2 images in a folder named as 1.jgp , 2.jpg. I want to write a python code to display all the images one after another in the same location of the pane after 2 second delay.
  I have tried the following code:</p>
  
  <pre><code>import cv2
  import matplotlib.pyplot as plt
  import time
  
  def main():
      imgPath="/home/unikx/1_project/codes/batman.jpg"
      imgPath2="/home/unikx/1_project/codes/batman2.jpg"
      img1=cv2.imread(imgPath,1)
      img2=cv2.imread(imgPath2,1)
  
      img1=cv2.cvtColor(img1,cv2.COLOR_BGR2RGB)
      img2=cv2.cvtColor(img2,cv2.COLOR_BGR2RGB)
  
      plt.subplot(1,1,1)
      plt.imshow(img1)
      plt.title("Image 1")
      plt.xticks([])
      plt.yticks([])
      plt.show(block=False)
      time.sleep(2)
      plt.close()
  
      plt.subplot(1,1,1)
      plt.imshow(img2)
      plt.title("Image 2")
      plt.xticks([])
      plt.yticks([])
      plt.show(block=False)
      time.sleep(2)
      plt.close()
  
  
      plt.imshow(img1)
      plt.title("Again Image 1")
      plt.xticks([])
      plt.yticks([])
      plt.show()
      time.sleep(2)
      plt.close()
  
  import matplotlib 
  matplotlib.pyplot.close("all")
  
  if __name__=="__main__":
      main()
  </code></pre>
  
  <p>But this code displays 1.jpg in a window then once I close it, it displays the 2.jpg. I want image 1 to display then image 2 after 2 second in that  same window.</p>