nngogol / PySimpleGUIDocGen

Software for making documentation for PySimpleGUI
9 stars 2 forks source link

Class Properties #48

Closed MikeTheWatchGuy closed 5 years ago

MikeTheWatchGuy commented 5 years ago

How should we handle class properties?

I get these warnings at the moment:

Completed making readme.md
2019-08-19 16:37:50,180>INFO: STARTING
2019-08-19 16:37:50,180>INFO: STARTING
2019-08-19 16:37:50,204>ERROR: PROBLEM WITH "<property object at 0x0000021366BE6228>" "TKCanvas":
it's signature is BS. Ok, I will just return '' for 'signature' and 'param_table'
OR BETTER - delete it from the 2_readme.md.
======
2019-08-19 16:37:50,215>ERROR: PROBLEM WITH "<property object at 0x0000021366BE62C8>" "TKCanvas":
it's signature is BS. Ok, I will just return '' for 'signature' and 'param_table'
OR BETTER - delete it from the 2_readme.md.
======
2019-08-19 16:37:50,225>ERROR: PROBLEM WITH "<property object at 0x0000021366BE6048>" "TKOut":
it's signature is BS. Ok, I will just return '' for 'signature' and 'param_table'
OR BETTER - delete it from the 2_readme.md.
======
2019-08-19 16:37:50,248>ERROR: PROBLEM WITH "<property object at 0x0000021366BE6958>" "AlphaChannel":
it's signature is BS. Ok, I will just return '' for 'signature' and 'param_table'
OR BETTER - delete it from the 2_readme.md.
======
2019-08-19 16:37:50,261>ERROR: PROBLEM WITH "<property object at 0x0000021366BE69A8>" "Size":
it's signature is BS. Ok, I will just return '' for 'signature' and 'param_table'
OR BETTER - delete it from the 2_readme.md.
======

The tkcanvas is probably the shortest example as I can give you the entire class.

The others are in the Windows class

class Canvas(Element):
    """ """

    def __init__(self, canvas=None, background_color=None, size=(None, None), pad=None, key=None, tooltip=None,
                 right_click_menu=None, visible=True):
        """

        :param canvas: (tk.Canvas) Your own tk.Canvas if you already created it. Leave blank to create a Canvas
        :param background_color: (str) color of background
        :param size: Tuple[int,int]  (width in char, height in rows) size in pixels to make canvas
        :param pad:  Amount of padding to put around element
        :param key: (Any) Used with window.FindElement and with return values to uniquely identify this element
        :param tooltip: (str) text, that will appear when mouse hovers over the element
        :param right_click_menu: List[List[Union[List[str],str]]] A list of lists of Menu items to show when this element is right clicked. See user docs for exact format.
        :param visible: (bool) set visibility state of the element
        """

        self.BackgroundColor = background_color if background_color is not None else DEFAULT_BACKGROUND_COLOR
        self._TKCanvas = canvas
        self.RightClickMenu = right_click_menu

        super().__init__(ELEM_TYPE_CANVAS, background_color=background_color, size=size, pad=pad, key=key,
                         tooltip=tooltip, visible=visible)
        return

    @property
    def TKCanvas(self):
        """ """
        if self._TKCanvas is None:
            print('*** Did you forget to call Finalize()? Your code should look something like: ***')
            print('*** form = sg.Window("My Form").Layout(layout).Finalize() ***')
        return self._TKCanvas
nngogol commented 5 years ago

Let me think

nngogol commented 5 years ago

fixed