def _add_environment_frame():
    rendered_env = rendering_environment.render()
    image = Image.fromarray(rendered_env.astype(np.uint8), mode='RGB')
    draw = ImageDraw.Draw(image)
    draw.text((5, 5), ('TR: %.1f' % total_reward), font=font)
    image_as_numpy = np.array(image.getdata()).reshape(rendered_env.shape).astype(np.uint8)
    video.append_data(image_as_numpy)
def _add_environment_frame():
    rendered_env = rendering_environment.render()
    image = Image.fromarray(rendered_env.astype(np.uint8), mode='RGB')
    draw = ImageDraw.Draw(image)
    draw.text((5, 5), ('TR: %.1f' % total_reward), font=font)
    image_as_numpy = np.array(image.getdata()).reshape(rendered_env.shape).astype(np.uint8)
    video.append_data(image_as_numpy)