The function on.paint(gc) is called when the script's window needs to be painted. 'gc' is the Graphics Context, passed by default to the function.