|
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 |
2 | 4 |
|
3 | 5 |
|
4 | 6 | """ |
|
15 | 17 | def draw_line(x1:float, y1:float, x2:float, y2:float): |
16 | 18 | """ |
17 | 19 | 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] |
24 | 29 | """ |
| 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 | + |
25 | 35 | err.type_error(float, "float", x1) |
26 | 36 | err.type_error(float, "float", y1) |
27 | 37 | err.type_error(float, "float", x2) |
28 | 38 | err.type_error(float, "float", y2) |
29 | 39 |
|
| 40 | + log("Drawing line from ( " + str(x1) + " | " + str(y1) + " ) to ( " + str(x2) + " | " + str(y2) + " )", "INFO", "TI Draw", "Draw Line") |
30 | 41 | print("Drawing line from ( " + str(x1) + " | " + str(y1) + " ) to ( " + str(x2) + " | " + str(y2) + " )") |
31 | 42 | return [x1, y1, x2, y2] |
32 | 43 |
|
@@ -354,7 +365,7 @@ def use_buffer(): |
354 | 365 | |
355 | 366 | Returns None |
356 | 367 | """ |
357 | | - print("Enabeled off-screen buffer") |
| 368 | + print("Enabled off-screen buffer") |
358 | 369 | return None |
359 | 370 |
|
360 | 371 | ########################################################################################### |
|
0 commit comments