Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Wand path_line() function in Python

  • Last Updated : 20 Jun, 2021

path_line() is a function specially introduced for paths. path_line() draws a line from a destination point to the point we want the line we end to. It takes only end point as argument.
 

Syntax : 
 

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course

wand.drawing.path_line(to, relative)

Parameters:



 

ParameterInput TypeDescription
tosequence or (numbers.Real, numbers.Real)pair which represents coordinates to drawn to.
relativebooltreat given coordinates as relative to current point.

Example #1: 
 

Python3




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, 100))
 
    # Continue path to right
    draw.path_line(to =(100, 0),
                    relative = True)
 
    # Continue path to bottom left
    draw.path_line(to =(10, 80),
                    relative = True)
    draw.path_finish()
    with Image(width = 200, height = 200, background = Color('lightgreen')) as image:
        draw(image)
        image.save(filename ="pathline.png")

Output : 
 

 

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!