Skip to content

Commit a5be60c

Browse files
fixes #110
1 parent c823988 commit a5be60c

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

ti_python_module/ti_draw.py

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import ti_python_module.err as err
1+
from ti_python_module.err import withConsole as err
2+
from ti_python_module.err import onlyCheck as cerr
3+
from ti_python_module.file_handler import create_log as log
24

35

46
"""
@@ -15,18 +17,27 @@
1517
def draw_line(x1:float, y1:float, x2:float, y2:float):
1618
"""
1719
Draws a line starting from the specified x1,y1 coordinate to x2,y2.
18-
19-
20-
Category: TI Draw / Shape
21-
22-
23-
Returns an array / list: [x1, y1, x2, y2]
20+
21+
Args:
22+
x1 (float): The first x coordinate.
23+
y1 (float): The first y coordinate.
24+
x2 (float): The second x coordinate.
25+
y2 (float): The second y coordinate.
26+
27+
Returns:
28+
list: a list containing the following data: [x1, y1, x2, y2]
2429
"""
30+
if cerr.type_error(float, x1) == False: log("Argument 'x1' has to be type float!", "ERROR", "TI Draw", "Draw Line")
31+
if cerr.type_error(float, y1) == False: log("Argument 'y1' has to be type float!", "ERROR", "TI Draw", "Draw Line")
32+
if cerr.type_error(float, x2) == False: log("Argument 'x2' has to be type float!", "ERROR", "TI Draw", "Draw Line")
33+
if cerr.type_error(float, y2) == False: log("Argument 'y2' has to be type float!", "ERROR", "TI Draw", "Draw Line")
34+
2535
err.type_error(float, "float", x1)
2636
err.type_error(float, "float", y1)
2737
err.type_error(float, "float", x2)
2838
err.type_error(float, "float", y2)
2939

40+
log("Drawing line from ( " + str(x1) + " | " + str(y1) + " ) to ( " + str(x2) + " | " + str(y2) + " )", "INFO", "TI Draw", "Draw Line")
3041
print("Drawing line from ( " + str(x1) + " | " + str(y1) + " ) to ( " + str(x2) + " | " + str(y2) + " )")
3142
return [x1, y1, x2, y2]
3243

@@ -354,7 +365,7 @@ def use_buffer():
354365
355366
Returns None
356367
"""
357-
print("Enabeled off-screen buffer")
368+
print("Enabled off-screen buffer")
358369
return None
359370

360371
###########################################################################################

0 commit comments

Comments
 (0)