title: How to clear the graph drawn inPySimpleGUI?
body: <p>Is there a way to clear the graph in PySimpleGUI before redraw a new image? i notice the function <strong>window[&quot;-GRAPH-&quot;].draw_image()</strong> is causing a serious memory leak when the program run for sometime, as it is trying to stack the picture on top of all drawn images.</p>
  <p>Background:</p>
  <blockquote>
  <p>My app is trying to show a live feed from a webcam, meanwhile will also do some drawing (depending on mouse click) on top of the camera feed. In order to detect the mouse click event from the camera feed, im using sg.Graph to capture mouse position.</p>
  </blockquote>
  <p>sample_app_display: <a href="https://i.stack.imgur.com/clMkN.png" rel="nofollow noreferrer">user label the box of object in a live camera feed</a></p>
  <p>Code Snippet:</p>
  <pre><code>sg.Graph(853, (0, 480), (853, 0), key=&quot;-GRAPH-&quot;, change_submits=True, drag_submits=False)
  
  ...
  
  camera = my_opencv_library(device=0)
  while True:
      event, values = window.read(timeout=20)
      if event == &quot;-GRAPH-&quot;:
          camera.update_coordinate(values[&quot;-GRAPH-&quot;])
  
      # obtain live feed with runtime drawing (based on mouse click)
      frame = camera.get_frame()
      imgbytes = cv2.imencode(&quot;.png&quot;, frame)[1].tobytes()
      window[&quot;-GRAPH-&quot;].draw_image(data=imgbytes, location=(0,0))
  </code></pre>