MCPcopy
hub / github.com/PySimpleGUI/PySimpleGUI / draw_text

Method draw_text

PySimpleGUI/PySimpleGUI.py:6521–6552  ·  view source on GitHub ↗

Draw some text on your graph. This is how you label graph number lines for example :param text: text to display :type text: (Any) :param location: location to place first letter :type location: (int, int) | Tuple[float, float]

(self, text, location, color='black', font=None, angle=0, text_location=TEXT_LOCATION_CENTER)

Source from the content-addressed store, hash-verified

6519 return id
6520
6521 def draw_text(self, text, location, color='black', font=None, angle=0, text_location=TEXT_LOCATION_CENTER):
6522 """
6523 Draw some text on your graph. This is how you label graph number lines for example
6524
6525 :param text: text to display
6526 :type text: (Any)
6527 :param location: location to place first letter
6528 :type location: (int, int) | Tuple[float, float]
6529 :param color: text color
6530 :type color: (str)
6531 :param font: specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike
6532 :type font: (str or (str, int[, str]) or None)
6533 :param angle: Angle 0 to 360 to draw the text. Zero represents horizontal text
6534 :type angle: (float)
6535 :param text_location: "anchor" location for the text. Values start with TEXT_LOCATION_
6536 :type text_location: (str)
6537 :return: id returned from tkinter that you'll need if you want to manipulate the text
6538 :rtype: int | None
6539 """
6540 text = str(text)
6541 if location == (None, None):
6542 return
6543 converted_point = self._convert_xy_to_canvas_xy(location[0], location[1])
6544 if self._TKCanvas2 is None:
6545 print('*** WARNING - The Graph element has not been finalized and cannot be drawn upon ***')
6546 print('Call Window.Finalize() prior to this operation')
6547 return None
6548 try: # in case closed with X
6549 id = self._TKCanvas2.create_text(converted_point[0], converted_point[1], text=text, font=font, fill=color, angle=angle, anchor=text_location)
6550 except:
6551 id = None
6552 return id
6553
6554 def draw_image(self, filename=None, data=None, location=(None, None)):
6555 """

Callers 12

mainFunction · 0.95
mainFunction · 0.95
draw_axisFunction · 0.80
update_player1_scoreMethod · 0.80
update_player2_scoreMethod · 0.80
Demo_Bar_Chart.pyFile · 0.80
update_meterFunction · 0.80
mainFunction · 0.80
_display_notificationFunction · 0.80
display_notificationFunction · 0.80
notifyMethod · 0.80

Calls 1

Tested by

no test coverage detected