Draws a line from one point to another point using USER'S coordinates. Can set the color and width of line :param point_from: Starting point for line :type point_from: (int, int) | Tuple[float, float] :param point_to: Ending point for line :type point_to:
(self, point_from, point_to, color='black', width=1, arrow=None, arrow_shape=None)
| 6265 | return floor(new_x), floor(new_y) |
| 6266 | |
| 6267 | def draw_line(self, point_from, point_to, color='black', width=1, arrow=None, arrow_shape=None): |
| 6268 | """ |
| 6269 | Draws a line from one point to another point using USER'S coordinates. Can set the color and width of line |
| 6270 | :param point_from: Starting point for line |
| 6271 | :type point_from: (int, int) | Tuple[float, float] |
| 6272 | :param point_to: Ending point for line |
| 6273 | :type point_to: (int, int) | Tuple[float, float] |
| 6274 | :param color: Color of the line |
| 6275 | :type color: (str) |
| 6276 | :param width: width of line in pixels |
| 6277 | :type width: (int) |
| 6278 | :param arrow: Determines if an arrowhead will be added to the line. Literal string "first", "last", "both" |
| 6279 | :type arrow: (str) |
| 6280 | :param arrow_shape: Defines the shape of the arrowhead using a tuple with (length, width, thickness) |
| 6281 | :type arrow_shape: Tuple[float, float, float] |
| 6282 | :return: id returned from tktiner or None if user closed the window. id is used when you |
| 6283 | :rtype: int | None |
| 6284 | """ |
| 6285 | if point_from == (None, None): |
| 6286 | return |
| 6287 | converted_point_from = self._convert_xy_to_canvas_xy(point_from[0], point_from[1]) |
| 6288 | converted_point_to = self._convert_xy_to_canvas_xy(point_to[0], point_to[1]) |
| 6289 | if self._TKCanvas2 is None: |
| 6290 | print('*** WARNING - The Graph element has not been finalized and cannot be drawn upon ***') |
| 6291 | print('Call Window.Finalize() prior to this operation') |
| 6292 | return None |
| 6293 | try: # in case window was closed with an X |
| 6294 | id = self._TKCanvas2.create_line(converted_point_from, converted_point_to, width=width, fill=color, arrow=arrow, arrowshape=arrow_shape) |
| 6295 | except Exception as e: |
| 6296 | # print(e) |
| 6297 | id = None |
| 6298 | return id |
| 6299 | |
| 6300 | |
| 6301 | def draw_lines(self, points, color='black', width=1): |
no test coverage detected