Drawing Shapes
Last updated
Last updated
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)
Example:
RegPolygon(nsides, center_xy, radius)
Example:
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.
The points_list
property MUST have an even number of values. It must consist of xy pairs for each point.
Example:
Line(xy1, xy2)
OR
Line(points_list)
Example:
Circle(center_xy, radius)
Example:
Oval(center_xy, width, height)
Example:
Arc(center_xy, width, height, sweep_angle)
There are 3 different styles:
Note: The "arc" style uses the border_color
and border_width
only.
Example:
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.
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.
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.
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.
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.
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.
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.