MCPcopy
hub / github.com/PySimpleGUI/PySimpleGUI / ErrorElement

Class ErrorElement

PySimpleGUI/PySimpleGUI.py:9629–9669  ·  view source on GitHub ↗

A "dummy Element" that is returned when there are error conditions, like trying to find an element that's invalid

Source from the content-addressed store, hash-verified

9627# Error Element #
9628# ---------------------------------------------------------------------- #
9629class ErrorElement(Element):
9630 """
9631 A "dummy Element" that is returned when there are error conditions, like trying to find an element that's invalid
9632 """
9633
9634 def __init__(self, key=None, metadata=None):
9635 """
9636 :param key: Used with window.find_element and with return values to uniquely identify this element
9637 :type key:
9638 """
9639 self.Key = key
9640
9641 super().__init__(ELEM_TYPE_ERROR, key=key, metadata=metadata)
9642
9643 def update(self, silent_on_error=True, *args, **kwargs):
9644 """
9645 Update method for the Error Element, an element that should not be directly used by developer
9646
9647 :param silent_on_error: if False, then a Popup window will be shown
9648 :type silent_on_error: (bool)
9649 :param *args: meant to "soak up" any normal parameters passed in
9650 :type *args: (Any)
9651 :param **kwargs: meant to "soak up" any keyword parameters that were passed in
9652 :type **kwargs: (Any)
9653 :return: returns 'self' so call can be chained
9654 :rtype: (ErrorElement)
9655 """
9656 print('** Your update is being ignored because you supplied a bad key earlier **')
9657 return self
9658
9659 def get(self):
9660 """
9661 One of the method names found in other Elements. Used here to return an error string in case it's called
9662
9663 :return: A warning text string.
9664 :rtype: (str)
9665 """
9666 return 'This is NOT a valid Element!\nSTOP trying to do things with it or I will have to crash at some point!'
9667
9668 Get = get
9669 Update = update
9670
9671
9672# ---------------------------------------------------------------------- #

Callers 1

find_elementMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected