I am making a radar in python and what I want to do is to make every point detected (plotted on the map) deleted after, let's say, 2 seconds. I am beginner at Python, so I am probably not doing it the best way. I am using Signal module to attach a 'handler' function to the signal that would work as an interrupt after every 2 seconds, saying that 'the oldest' detected point on the plot should be deleted. I am not sure how to delete a point that was plotted, so I just 'colored' it by plotting the same point but in the color of the background :/ I am having my detected points in a 'points' list.
def handler():
if 0 != len(points):
ax.plot(points[0][0], points[0][1], color='#8DEEEE')
points.pop(0)
#Set the signal handler and a 2-second alarm
signal.signal(signal.SIGALARM, handler)
signal.alarm(2)