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

Method draw_polygon

PySimpleGUI/PySimpleGUI.py:6494–6519  ·  view source on GitHub ↗

Draw a polygon given list of points :param points: list of points that define the polygon :type points: List[(int, int) | Tuple[float, float]] :param fill_color: color of the interior :type fill_color: (str) :param line_color: color of outl

(self, points, fill_color=None, line_color=None, line_width=None)

Source from the content-addressed store, hash-verified

6492 return id
6493
6494 def draw_polygon(self, points, fill_color=None, line_color=None, line_width=None):
6495 """
6496 Draw a polygon given list of points
6497
6498 :param points: list of points that define the polygon
6499 :type points: List[(int, int) | Tuple[float, float]]
6500 :param fill_color: color of the interior
6501 :type fill_color: (str)
6502 :param line_color: color of outline
6503 :type line_color: (str)
6504 :param line_width: width of the line in pixels
6505 :type line_width: (int)
6506 :return: id returned from tkinter that you'll need if you want to manipulate the rectangle
6507 :rtype: int | None
6508 """
6509
6510 converted_points = [self._convert_xy_to_canvas_xy(point[0], point[1]) for point in points]
6511 if self._TKCanvas2 is None:
6512 print('*** WARNING - The Graph element has not been finalized and cannot be drawn upon ***')
6513 print('Call Window.Finalize() prior to this operation')
6514 return None
6515 try: # in case closed with X
6516 id = self._TKCanvas2.create_polygon(converted_points, fill=fill_color, outline=line_color, width=line_width)
6517 except:
6518 id = None
6519 return id
6520
6521 def draw_text(self, text, location, color='black', font=None, angle=0, text_location=TEXT_LOCATION_CENTER):
6522 """

Callers 1

Calls 1

Tested by

no test coverage detected