MCPcopy Index your code
hub / github.com/PySimpleGUI/PySimpleGUI / add_row

Method add_row

PySimpleGUI/PySimpleGUI.py:7603–7652  ·  view source on GitHub ↗

Not recommended user call. Used to add rows of Elements to the Frame Element. :param *args: The list of elements for this row :type *args: List[Element]

(self, *args)

Source from the content-addressed store, hash-verified

7601 return
7602
7603 def add_row(self, *args):
7604 """
7605 Not recommended user call. Used to add rows of Elements to the Frame Element.
7606
7607 :param *args: The list of elements for this row
7608 :type *args: List[Element]
7609 """
7610
7611 NumRows = len(self.Rows) # number of existing rows is our row number
7612 CurrentRowNumber = NumRows # this row's number
7613 CurrentRow = [] # start with a blank row and build up
7614 # ------------------------- Add the elements to a row ------------------------- #
7615 for i, element in enumerate(args): # Loop through list of elements and add them to the row
7616 if type(element) == list:
7617 PopupError('Error creating Tab layout',
7618 'Layout has a LIST instead of an ELEMENT',
7619 'This sometimes means you have a badly placed ]',
7620 'The offensive list is:',
7621 element,
7622 'This list will be stripped from your layout', keep_on_top=True, image=_random_error_emoji()
7623 )
7624 continue
7625 elif callable(element) and not isinstance(element, Element):
7626 PopupError('Error creating Tab layout',
7627 'Layout has a FUNCTION instead of an ELEMENT',
7628 'This likely means you are missing () from your layout',
7629 'The offensive list is:',
7630 element,
7631 'This item will be stripped from your layout', keep_on_top=True, image=_random_error_emoji())
7632 continue
7633 if element.ParentContainer is not None:
7634 warnings.warn(
7635 '*** YOU ARE ATTEMPTING TO REUSE AN ELEMENT IN YOUR LAYOUT! Once placed in a layout, an element cannot be used in another layout. ***',
7636 UserWarning)
7637 PopupError('Error creating Tab layout',
7638 'The layout specified has already been used',
7639 'You MUST start witha "clean", unused layout every time you create a window',
7640 'The offensive Element = ',
7641 element,
7642 'and has a key = ', element.Key,
7643 'This item will be stripped from your layout',
7644 'Hint - try printing your layout and matching the IDs "print(layout)"', keep_on_top=True, image=_random_error_emoji())
7645 continue
7646 element.Position = (CurrentRowNumber, i)
7647 element.ParentContainer = self
7648 CurrentRow.append(element)
7649 if element.Key is not None:
7650 self.UseDictionary = True
7651 # ------------------------- Append the row to list of Rows ------------------------- #
7652 self.Rows.append(CurrentRow)
7653
7654 def layout(self, rows):
7655 """

Callers 1

add_tabMethod · 0.95

Calls 1

_random_error_emojiFunction · 0.85

Tested by

no test coverage detected