Wednesday, July 3, 2024
HomeLanguagesPythonWand path_start() function in Python

Wand path_start() function in Python

We can also draw paths in wand.drawing module. Each path method expects a destination point, and will draw from the current point to the new point. The destination point will become the new current point for the next applied path method. Paths in wand consist of some other methods to draw different graphics in a path.
In this article we will learn path_start() function. path is initiated using path_start function.

Syntax: wand.drawing.path_start()

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.path_start()
      
    # Start middle-left
    draw.path_move(to =(100, 100))
    draw.path_horizontal_line(1)
      
    # Close first & last points
    draw.path_close()
    draw.path_finish()
    with Image(width = 200
               height = 200,
               background = Color('green')) as image:
          
        draw(image)
        image.save(filename = "pathstart.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.path_start()
      
    # Start middle-left
    draw.path_move(to=(100, 100))
      
    # draw a vertical line from path initial point
    draw.path_vertical_line(1)
      
    # Close first & last points
    draw.path_close()
    draw.path_finish()
    with Image(width=200,
               height=200,
               background=Color('green')) as image:
        draw(image)
        image.save(filename = "pathstart.png")


Output:

Thapelo Manthata
I’m a desktop support specialist transitioning into a SharePoint developer role by day and Software Engineering student by night. My superpowers include customer service, coding, the Microsoft office 365 suite including SharePoint and power platform.
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments