Open In App

Wand | path_vertical_line() in Python

Last Updated : 11 May, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

path_vertical_line() is another function for path. path_vertical_line() function generates a vertical line from a destination point to a particular y point. It takes only y point upto which line is being drawn.

Syntax: wand.drawing.path_vertical_line(to, relative)

Parameters:

Parameter Input Type Description
y Real y-axis point to draw to.
relative bool treat given coordinates as relative to current point.

Example #1:




from wand.image import Image
from wand.drawing import Drawing
from wand.color import Color
   
with Drawing() as draw:
    draw.stroke_width = 2
    draw.stroke_color = Color('black')
    draw.fill_color = Color('white')
    draw.path_start()
      
    # Start middle-left
    draw.path_move(to=(10, 50))
      
    # Line to top-right
    draw.path_vertical_line(100)
    draw.path_finish()
    with Image(width=200,
               height=200
               background=Color('lightgreen')) as image:
          
        draw(image)
        image.save(filename="pathvline.png")


Output:

Example #2:




from wand.image import Image
from wand.drawing import Drawing
from wand.color import Color
   
with Drawing() as draw:
    draw.stroke_width = 2
    draw.stroke_color = Color('black')
    draw.fill_color = Color('white')
    draw.path_start()
      
    # Start middle-left
    draw.path_move(to=(100, 100))
      
    # Line to top-right
    draw.path_vertical_line(50)
    draw.path_finish()
    with Image(width=200
               height=200
               background=Color('lightgreen')) as image:
          
        draw(image)
        image.save(filename="pathvline.png")


Output:



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads