MCPcopy
hub / github.com/PySimpleGUI/PySimpleGUI / move_to_center

Method move_to_center

PySimpleGUI/PySimpleGUI.py:11243–11254  ·  view source on GitHub ↗

Recenter your window after it's been moved or the size changed. This is a conveinence method. There are no tkinter calls involved, only pure PySimpleGUI API calls.

(self)

Source from the content-addressed store, hash-verified

11241 pass
11242
11243 def move_to_center(self):
11244 """
11245 Recenter your window after it's been moved or the size changed.
11246
11247 This is a conveinence method. There are no tkinter calls involved, only pure PySimpleGUI API calls.
11248 """
11249 if not self._is_window_created('tried Window.move_to_center'):
11250 return
11251 screen_width, screen_height = self.get_screen_dimensions()
11252 win_width, win_height = self.size
11253 x, y = (screen_width - win_width) // 2, (screen_height - win_height) // 2
11254 self.move(x, y)
11255
11256 def minimize(self):
11257 """

Callers

nothing calls this directly

Calls 3

_is_window_createdMethod · 0.95
get_screen_dimensionsMethod · 0.95
moveMethod · 0.95

Tested by

no test coverage detected