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

Method current_size_accurate

PySimpleGUI/PySimpleGUI.py:11851–11869  ·  view source on GitHub ↗

Get the current location of the window based on tkinter's geometry setting :return: The x and y size in tuple form (x,y) :rtype: Tuple[(int | None), (int | None)]

(self)

Source from the content-addressed store, hash-verified

11849 return (x,y)
11850
11851 def current_size_accurate(self):
11852 """
11853 Get the current location of the window based on tkinter's geometry setting
11854
11855 :return: The x and y size in tuple form (x,y)
11856 :rtype: Tuple[(int | None), (int | None)]
11857 """
11858
11859 if not self._is_window_created('tried Window.current_location'):
11860 return (None, None)
11861 try:
11862 geometry = self.TKroot.geometry()
11863 geometry_tuple = geometry.split('+')
11864 window_size = geometry_tuple[0].split('x')
11865 x, y = int(window_size[0]), int(window_size[1])
11866 except Exception as e:
11867 warnings.warn('Error in Window.current_size_accurate. Trouble getting x,y size\n{} {}'.format(geometry, geometry_tuple) + str(e), UserWarning)
11868 x, y = (None, None)
11869 return (x,y)
11870
11871 @property
11872 def size(self):

Calls 1

_is_window_createdMethod · 0.95

Tested by

no test coverage detected