For Python;
You would have to capture the image first, e.g. using the Python Imaging Library. You could use its ImageDraw module to draw lines and arcs on the image.
If you want to draw (Bézier) curves, you would need to find a library that can handle those. E.g. cairo, with the py-cairo bindings.