New to programming, I am trying to plot road boundary-like lines. Basically, I am creating something like a road map and I want a rectangle to always be moving through the trajectory (I mean, the x, y coordinates of the rectangle increase with relation to the lines).
The idea is like the image below.
Can anyone help me? How do I create and plot the red lines as well as the black rectangle which is moving in the direction of the arrows?
UPDATE: I need to check that the distance from the rectangle to the lines is under a certain threshold each time. I think I might need to use some kind of array/element. But I am not clear how to use it. Can anyone help me? Thanks.


You can use pygames and literally draw anything anyway. Since you have not started on it at all, try this tutorial here
Or you could try turtle.