Made Window.metadata and SystemTray.metadata also properties

This commit is contained in:
PySimpleGUI 2021-01-17 12:45:06 -05:00
parent 55871d89bf
commit faa701e3de
1 changed files with 42 additions and 0 deletions

View File

@ -7462,6 +7462,7 @@ class Window:
:type metadata: (Any)
"""
self._metadata = None # type: Any
self.AutoSizeText = auto_size_text if auto_size_text is not None else DEFAULT_AUTOSIZE_TEXT
self.AutoSizeButtons = auto_size_buttons if auto_size_buttons is not None else DEFAULT_AUTOSIZE_BUTTONS
self.Title = str(title)
@ -7620,6 +7621,26 @@ class Window:
root.destroy()
return screen_width, screen_height
@property
def metadata(self):
"""
Metadata is available for all windows. You can set to any value.
:return: the current metadata value
:rtype: (Any)
"""
return self._metadata
@metadata.setter
def metadata(self, value):
"""
Metadata is available for all windows. You can set to any value.
:param value: Anything you want it to be
:type value: (Any)
"""
self._metadata = value
# ------------------------- Add ONE Row to Form ------------------------- #
def add_row(self, *args):
"""
@ -9573,6 +9594,7 @@ class SystemTray:
:param metadata: User metadata that can be set to ANYTHING
:type metadata: (Any)
"""
self._metadata = None
self.Menu = menu
self.TrayIcon = None
self.Shown = False
@ -9597,6 +9619,26 @@ class SystemTray:
self.window['-IMAGE-'].bind('<Double-Button-1>', '+DOUBLE_CLICK')
@property
def metadata(self):
"""
Metadata is an SystemTray property that you can use at any time to hold any value
:return: the current metadata value
:rtype: (Any)
"""
return self._metadata
@metadata.setter
def metadata(self, value):
"""
Metadata is an SystemTray property that you can use at any time to hold any value
:param value: Anything you want it to be
:type value: (Any)
"""
self._metadata = value
def read(self, timeout=None):
"""