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

Method _convert_canvas_xy_to_xy

PySimpleGUI/PySimpleGUI.py:6244–6265  ·  view source on GitHub ↗

Not user callable. Used to convert tkinter Canvas coords into user's coordinates :param x_in: The x coordinate in canvas coordinates :type x_in: (int) :param y_in: (int) The y coordinate in canvas coordinates :type y_in: :return: The converted

(self, x_in, y_in)

Source from the content-addressed store, hash-verified

6242 return new_x, new_y
6243
6244 def _convert_canvas_xy_to_xy(self, x_in, y_in):
6245 """
6246 Not user callable. Used to convert tkinter Canvas coords into user's coordinates
6247
6248 :param x_in: The x coordinate in canvas coordinates
6249 :type x_in: (int)
6250 :param y_in: (int) The y coordinate in canvas coordinates
6251 :type y_in:
6252 :return: The converted USER coordinates
6253 :rtype: (int, int) | Tuple[float, float]
6254 """
6255 if None in (x_in, y_in):
6256 return None, None
6257 scale_x = (self.CanvasSize[0] - 0) / (self.TopRight[0] - self.BottomLeft[0])
6258 scale_y = (0 - self.CanvasSize[1]) / (self.TopRight[1] - self.BottomLeft[1])
6259
6260 new_x = x_in / scale_x + self.BottomLeft[0]
6261 new_y = (y_in - self.CanvasSize[1]) / scale_y + self.BottomLeft[1]
6262 if self.FloatValues:
6263 return new_x, new_y
6264 else:
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 """

Callers 5

get_bounding_boxMethod · 0.95
motion_call_backMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected