MCPcopy
hub / github.com/PySimpleGUI/PySimpleGUI / relocate_figure

Method relocate_figure

PySimpleGUI/PySimpleGUI.py:6689–6710  ·  view source on GitHub ↗

Move a previously made figure to an arbitrary (x,y) location. This differs from the Move methods because it uses absolute coordinates versus relative for Move :param figure: Previously obtained figure-id. These are returned from all Draw methods :type figure: (id)

(self, figure, x, y)

Source from the content-addressed store, hash-verified

6687 self._TKCanvas2.move(figure, shift_amount[0], shift_amount[1])
6688
6689 def relocate_figure(self, figure, x, y):
6690 """
6691 Move a previously made figure to an arbitrary (x,y) location. This differs from the Move methods because it
6692 uses absolute coordinates versus relative for Move
6693
6694 :param figure: Previously obtained figure-id. These are returned from all Draw methods
6695 :type figure: (id)
6696 :param x: location on X axis (in user coords) to move the upper left corner of the figure
6697 :type x: int | float
6698 :param y: location on Y axis (in user coords) to move the upper left corner of the figure
6699 :type y: int | float
6700 """
6701
6702 zero_converted = self._convert_xy_to_canvas_xy(0, 0)
6703 shift_converted = self._convert_xy_to_canvas_xy(x, y)
6704 shift_amount = (shift_converted[0] - zero_converted[0], shift_converted[1] - zero_converted[1])
6705 if figure is None:
6706 print('*** WARNING - Your figure is None. It most likely means your did not Finalize your Window ***')
6707 print('Call Window.Finalize() prior to all graph operations')
6708 return None
6709 xy = self._TKCanvas2.coords(figure)
6710 self._TKCanvas2.move(figure, shift_converted[0] - xy[0], shift_converted[1] - xy[1])
6711
6712 def send_figure_to_back(self, figure):
6713 """

Callers 3

drawMethod · 0.80
drawMethod · 0.80

Calls 2

moveMethod · 0.45

Tested by

no test coverage detected