New Class Method. Window.get_screen_size() returns tuple. Can be called any time. No previous window needed.

This commit is contained in:
PySimpleGUI 2019-09-20 13:14:45 -04:00
parent 627fda3ae0
commit d3a146d436
1 changed files with 9 additions and 1 deletions

View File

@ -1,5 +1,5 @@
#!/usr/bin/python3
version = __version__ = "4.5.0.17 Unreleased Mac Buttons. Element Resizing"
version = __version__ = "4.5.0.18 Unreleased Mac Buttons. Element Resizing. Screen Size"
# 888888ba .d88888b oo dP .88888. dP dP dP
@ -5206,6 +5206,14 @@ class Window:
self.NumOpenWindows -= 1 * (self.NumOpenWindows != 0) # decrement if not 0
# print('----- DECREMENTING Num Open Windows = {} ---'.format(Window.NumOpenWindows))
@classmethod
def get_screen_size(self):
root = tk.Tk()
screen_width = root.winfo_screenwidth() # get window info to move to middle of screen
screen_height = root.winfo_screenheight()
root.destroy()
return screen_width, screen_height
# ------------------------- Add ONE Row to Form ------------------------- #
def AddRow(self, *args):
"""