Skip to content

Commit 0edefcf

Browse files
fixes #112
1 parent a7198f9 commit 0edefcf

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

ti_python_module/ti_draw.py

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,14 @@ def draw_rect(x_start:float, y_start:float, width:float, height:float):
4747
"""
4848
Draws a rectangle starting at the specified x,y coordinate with the specified width and height.
4949
50-
51-
Category: TI Draw / Shape
52-
53-
54-
Returns an array / list: [x_start, y_start, width, height]
50+
Args:
51+
x_start (float): The starting x coordinate.
52+
y_start (float): The starting y coordinate.
53+
width (float): The width of the rectangle.
54+
height (float): The height of the rectangle.
55+
56+
Returns:
57+
list: a list containing the following data: [x_start, y_start, width, height]
5558
"""
5659
if cerr.type_error(float, x_start) == False: log("Argument 'x_start' has to be type float!", "ERROR", "TI Draw", "Draw Rectangle")
5760
if cerr.type_error(float, y_start) == False: log("Argument 'y_start' has to be type float!", "ERROR", "TI Draw", "Draw Rectangle")
@@ -74,17 +77,27 @@ def fill_rect(x_start:float, y_start:float, width:float, height:float):
7477
"""
7578
Draws a rectangle starting at the specified x,y coordinate with the specified width and height and filled with the specified color (using set_color or black if not defined).
7679
77-
78-
Category: TI Draw / Shape
79-
80-
81-
Returns an array / list: [x_start, y_start, width, height]
80+
Args:
81+
x_start (float): The starting x coordinate.
82+
y_start (float): The starting y coordinate.
83+
width (float): The width of the rectangle.
84+
height (float): The height of the rectangle.
85+
86+
Returns:
87+
list: a list containing the following data: [x_start, y_start, width, height]
8288
"""
89+
if cerr.type_error(float, x_start) == False: log("Argument 'x_start' has to be type float!", "ERROR", "TI Draw", "Filled Rectangle")
90+
if cerr.type_error(float, y_start) == False: log("Argument 'y_start' has to be type float!", "ERROR", "TI Draw", "Filled Rectangle")
91+
if cerr.type_error(float, width) == False: log("Argument 'width' has to be type float!", "ERROR", "TI Draw", "Filled Rectangle")
92+
if cerr.type_error(float, height) == False: log("Argument 'height' has to be type float!", "ERROR", "TI Draw", "Fill Rectangle")
93+
94+
8395
err.type_error(float, "float", x_start)
8496
err.type_error(float, "float", y_start)
8597
err.type_error(float, "float", width)
8698
err.type_error(float, "float", height)
8799

100+
log("Drawing a filled rectangle from starting point: ( " + str(x_start) + " | " + str(y_start) + " ) with a width of '" + str(width) + "' and a height of '" + str(height) + "'", "INFO", "TI Draw", "Filled Rectangle")
88101
print("Drawing filled rectangle from starting point: ( " + str(x_start) + " | " + str(y_start) + " ) with a width of '" + str(width) + "' and a height of '" + str(height) + "'")
89102
return [x_start, y_start, width, height]
90103

0 commit comments

Comments
 (0)