MCPcopy Index your code
hub / github.com/PySimpleGUI/PySimpleGUI / draw_lines

Method draw_lines

PySimpleGUI/PySimpleGUI.py:6301–6323  ·  view source on GitHub ↗

Draw a series of lines given list of points :param points: list of points that define the polygon :type points: List[(int, int) | Tuple[float, float]] :param color: Color of the line :type color: (str) :param width: width of line in pixels

(self, points, color='black', width=1)

Source from the content-addressed store, hash-verified

6299
6300
6301 def draw_lines(self, points, color='black', width=1):
6302 """
6303 Draw a series of lines given list of points
6304
6305 :param points: list of points that define the polygon
6306 :type points: List[(int, int) | Tuple[float, float]]
6307 :param color: Color of the line
6308 :type color: (str)
6309 :param width: width of line in pixels
6310 :type width: (int)
6311 :return: id returned from tktiner or None if user closed the window. id is used when you
6312 :rtype: int | None
6313 """
6314 converted_points = [self._convert_xy_to_canvas_xy(point[0], point[1]) for point in points]
6315
6316 try: # in case window was closed with an X
6317 id = self._TKCanvas2.create_line(*converted_points, width=width, fill=color)
6318 except:
6319 if self._TKCanvas2 is None:
6320 print('*** WARNING - The Graph element has not been finalized and cannot be drawn upon ***')
6321 print('Call Window.Finalize() prior to this operation')
6322 id = None
6323 return id
6324
6325 def draw_point(self, point, size=2, color='black'):
6326 """

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected