diff --git a/PySimpleGUI.py b/PySimpleGUI.py index b722def7..f728054a 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1,5 +1,5 @@ #!/usr/bin/python3 -version = __version__ = "4.33.0.4 Unreleased\nAliases shown SDK reference, popup_scrolled fix, summary mode for SDK help, BIG PEP8 definition swap" +version = __version__ = "4.33.0.5 Unreleased\nAliases shown SDK reference, popup_scrolled fix, summary mode for SDK help, BIG PEP8 definition swap, changed metadata into a class property, docstring change for element lookups" __version__ = version.split()[0] # For PEP 396 and PEP 345 @@ -766,6 +766,8 @@ class Element(): self.TKEntry = None self.TKImage = None + self._metadata = None # type: Any + self.ParentForm = None # type: Window self.ParentContainer = None # will be a Form, Column, or Frame element # UNBIND self.TextInputDefault = None @@ -780,7 +782,7 @@ class Element(): self.Widget = None # Set when creating window. Has the main tkinter widget for element self.Tearoff = False # needed because of right click menu code self.ParentRowFrame = None # type tk.Frame - self.metadata = metadata # type: Any + self.metadata = metadata self.user_bind_dict = {} # Used when user defines a tkinter binding using bind method - convert bind string to key modifier self.user_bind_event = None # Used when user defines a tkinter binding using bind method - event data from tkinter self.pad_used = (0,0) # the amount of pad used when was inserted into the layout @@ -794,13 +796,32 @@ class Element(): def visible(self): """ Returns visibility state for the element. This is a READONLY property - To control visibility, use the element's update method :return: Visibility state for element :rtype: (bool) """ return self._visible + @property + def metadata(self): + """ + Metadata is an Element 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 Element 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 _RightClickMenuCallback(self, event): """ Callback function that's called when a right click happens. Shows right click menu as result @@ -9262,8 +9283,8 @@ class Window: window['element key'].Update :param key: The key to find - :type key: str | int | tuple | object"" - :rtype: Element | None + :type key: str | int | tuple | object + :rtype: Element | Input | Combo | OptionMenu | Listbox | Radio | Checkbox | Spin | Multiline | Text | StatusBar | Output | Button | ButtonMenu | ProgressBar | Image | Canvas | Graph | Frame | VerticalSeparator | HorizontalSeparator | Tab | TabGroup | Slider | Column | Pane | Menu | Table | Tree | ErrorElement | None """ return self.FindElement(key)