Drawing Shapes
When drawing shapes, the sequence matters. That is how the layering system works.
The first object in sequence that is drawn in your code will be at the bottom most layer of your drawing. The last object in sequence that is drawn in your code will be the top most layer of your drawing.
Rectangle(xy, width, height)

Property | Default Value | Description |
xy | REQUIRED (No default) | The x and y coordinate of the rectangle's top-left corner as a tuple. |
width | REQUIRED (No default) | The width of the rectangle in pixels. |
height | REQUIRED (No default) | The height of the rectangle in pixels. |
color | "black" | RGB tuple color value, hexadecimal color value, or string containing color name can be used. |
border_color | None | Color of the border. |
border_width | 0 | Size of the border in pixels. |
dashes | None | Size of the dashes for the border in pixels. |
visible | True | True = Shape can be seen. False = Shape cannot be seen. |
Example:
rect1 = easy_draw.Rectangle(
xy = (300, 300),
width = 200,
height = 150,
color = (255, 0, 0), # Optional Property
border_color = (0, 0, 0), # Optional Property
border_width = 10, # Optional Property
dashes = 25 # Optional Property
visible = True # Optional Property
)
RegPolygon(nsides, center_xy, radius)

Property | Default Value | Description |
nsides | REQUIRED (No default) | The number of sides the polygon has. |
center_xy | REQUIRED (No default) | The x and y coordinate of the polygon's center as a tuple. |
radius | REQUIRED (No default) | The distance in pixels from the center to any outer point. |
color | "black" | RGB tuple color value, hexadecimal color value, or string containing color name can be used. |
border_color | None | Color of the border. |
border_width | 0 | Size of the border in pixels. |
dashes | None | Size of the dashes for the border in pixels. |
visible | True | True = Shape can be seen. False = Shape cannot be seen. |
Example:
reg_poly1 = easy_draw.RegPolygon(
nsides = 8,
center_xy = (300, 300),
radius = 100,
color = (255, 0, 0), # Optional Property
border_color = (0, 0, 0), # Optional Property
border_width = 10, # Optional Property
dashes = 25 # Optional Property
)
Polygon(points_list)

The above image is just an example. The Polygon can have as many sides as you want, and is dependent on the number of xy coordinates you provide.
Property | Default Value | Description |
points_list | REQUIRED (No default) | A list of x y coordinates identifying the points of the polygon. List must have an even number of values. |
color | "black" | RGB tuple color value, hexadecimal color value, or string containing color name can be used. |
border_color | None | Color of the border. |
border_width | 0 | Size of the border in pixels. |
dashes | None | Size of the dashes for the border in pixels. |
visible | True | True = Shape can be seen. False = Shape cannot be seen. |
The
points_list
property MUST have an even number of values. It must consist of xy pairs for each point. Example:
poly1 = easy_draw.Polygon(
points_list = [25, 25, 150, 25, 200, 200, 100, 250, 25, 200],
color = (255, 0, 0), # Optional Property
border_color = (0, 0, 0), # Optional Property
border_width = 10, # Optional Property
dashes = 25 # Optional Property
)
Line(xy1, xy2)

OR
Line(points_list)

Property | Default Value | Description |
xy1 | REQUIRED if points_list is not provided (No default) | The starting xy coordinate of the line as a tuple. |
xy2 | REQUIRED if points_list is not provided (No default) | The ending xy coordinate of the line as a tuple. |
points_list | REQUIRED is xy1 and xy2 are not provided (No default) | A list of x y coordinates identifying the points of the line. List must have an even number of values. |
color | "black" | RGB tuple color value, hexadecimal color value, or string containing color name can be used. |
thickness | 5 | The width of the line. |
dashes | None | Size of the dashes for the border in pixels. |
arrow_start | False | Add an arrow to the start of the line. |
arrow_end | False | Add an arrow to the end of the line. |
style | "round" | Set property to "round" for round edges and joints and "cut" for squared/cut-off edges and joints. |
visible | True | True = Shape can be seen. False = Shape cannot be seen. |
Example:
line1 = easy_draw.Line(
xy1 = (100, 100),
xy2 = (200, 200),
thickness = 8, # Optional Property
color = (255, 0, 0), # Optional Property
dashes = 25 # Optional Property
)
# OR
line1 = easy_draw.Line(
points_list = [],
thickness = 8, # Optional Property
color = (0, 255, 0), # Optional Property
dashes = 25, # Optional Property
style = "cut" # Optional Property
)
Circle(center_xy, radius)

Property | Default Value | Description |
center_xy | REQUIRED (No default) | The center coordinate (x, y) of the circle. |
radius | REQUIRED (No default) | The measurement in pixels from the center of the circle to the edge. |
color | "black" | RGB tuple color value, hexadecimal color value, or string containing color name can be used. |
border_color | None | Color of the border. |
border_width | 0 | Size of the border in pixels. |
dashes | None | Size of the dashes for the border in pixels. |
visible | True | True = Shape can be seen. False = Shape cannot be seen. |
Example:
cir1 = easy_draw.Circle(
center_xy = (300, 300),
radius = 100,
color = (255, 0, 0), # Optional Property
border_color = (0, 0, 0), # Optional Property
border_width = 10, # Optional Property
dashes = 25 # Optional Property
)
Oval(center_xy, width, height)

Property | Default Value | Description |
center_xy | REQUIRED (No default) | The center coordinate (x, y) of the oval. |
width | REQUIRED (No default) | The measurement in pixels of the left edge to the right edge of the oval. |
height | REQUIRED (No default) | The measurement in pixels of the top edge to the bottom edge of the oval. |
color | "black" | RGB tuple color value, hexadecimal color value, or string containing color name can be used. |
border_color | None | Color of the border. |
border_width | 0 | Size of the border in pixels. |
dashes | None | Size of the dashes for the border in pixels. |
visible | True | True = Shape can be seen. False = Shape cannot be seen. |
Example:
oval1 = easy_draw.Oval(
center_xy = (300, 300),
width = 100,
height = 200,
color = (255, 0, 0), # Optional Property
border_color = (0, 0, 0), # Optional Property
border_width = 10, # Optional Property
dashes = 25 # Optional Property
)
Arc(center_xy, width, height, sweep_angle)

There are 3 different styles:

Note: The "arc" style uses the
border_color
and border_width
only. Property | Default Value | Description |
center_xy | REQUIRED (No default) | The center coordinate (x, y) of the circle used to create the arc. |
width | REQUIRED (No default) | The width of the circle used to create the arc. |
height | REQUIRED (No default) | The height of the circle used to create the arc. |
sweep_angle | REQUIRED (No default) | The amount of the arc to show. From 0 to the angle in degrees identified. |
color | "black" | RGB tuple color value, hexadecimal color value, or string containing color name can be used. |
border_color | None | Color of the border. |
border_width | 0 | Size of the border in pixels. |
dashes | None | Size of the dashes for the border in pixels. |
style | "pieslice" | The arc comes in three styles choices: "pieslice", "chord", and "arc" |
visible | True | True = Shape can be seen. False = Shape cannot be seen. |
Example:
arc1 = easy_draw.Arc(
center_xy = (300, 300),
width = 100,
height = 100,
sweep_angle = 90,
style = "chord", # Optional Property
color = (255, 0, 0), # Optional Property
border_color = (0, 0, 0), # Optional Property
border_width = 10, # Optional Property
dashes = 25 # Optional Property
)
Last modified 1yr ago