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

Method draw_circle

PySimpleGUI/PySimpleGUI.py:6358–6392  ·  view source on GitHub ↗

Draws a circle, cenetered at the location provided. Can set the fill and outline colors :param center_location: Center location using USER'S coordinate system :type center_location: (int, int) | Tuple[float, float] :param radius: Radius in user's coordinat

(self, center_location, radius, fill_color=None, line_color='black', line_width=1)

Source from the content-addressed store, hash-verified

6356 return id
6357
6358 def draw_circle(self, center_location, radius, fill_color=None, line_color='black', line_width=1):
6359 """
6360 Draws a circle, cenetered at the location provided. Can set the fill and outline colors
6361 :param center_location: Center location using USER'S coordinate system
6362 :type center_location: (int, int) | Tuple[float, float]
6363 :param radius: Radius in user's coordinate values.
6364 :type radius: int | float
6365 :param fill_color: color of the point to draw
6366 :type fill_color: (str)
6367 :param line_color: color of the outer line that goes around the circle (sorry, can't set thickness)
6368 :type line_color: (str)
6369 :param line_width: width of the line around the circle, the outline, in pixels
6370 :type line_width: (int)
6371 :return: id returned from tkinter that you'll need if you want to manipulate the circle
6372 :rtype: int | None
6373 """
6374 if center_location == (None, None):
6375 return
6376 converted_point = self._convert_xy_to_canvas_xy(center_location[0], center_location[1])
6377 radius_converted = self._convert_xy_to_canvas_xy(center_location[0] + radius, center_location[1])
6378 radius = radius_converted[0] - converted_point[0]
6379 # radius = radius_converted[1]-5
6380 if self._TKCanvas2 is None:
6381 print('*** WARNING - The Graph element has not been finalized and cannot be drawn upon ***')
6382 print('Call Window.Finalize() prior to this operation')
6383 return None
6384 # print('Oval parms', int(converted_point[0]) - int(radius), int(converted_point[1]) - int(radius),
6385 # int(converted_point[0]) + int(radius), int(converted_point[1]) + int(radius))
6386 try: # needed in case the window was closed with an X
6387 id = self._TKCanvas2.create_oval(int(converted_point[0]) - int(radius), int(converted_point[1]) - int(radius),
6388 int(converted_point[0]) + int(radius), int(converted_point[1]) + int(radius), fill=fill_color,
6389 outline=line_color, width=line_width)
6390 except:
6391 id = None
6392 return id
6393
6394 def draw_oval(self, top_left, bottom_right, fill_color=None, line_color=None, line_width=1):
6395 """

Callers 12

__init__Method · 0.80
mainFunction · 0.80
mainFunction · 0.80
add_ballsMethod · 0.80
add_ballsMethod · 0.80
mainFunction · 0.80
mainFunction · 0.80
SetLEDFunction · 0.80
add_ballMethod · 0.80
mainFunction · 0.80

Calls 1

Tested by

no test coverage detected