Not recommended user call. Used to add rows of Elements to the Column Element. :param *args: The list of elements for this row :type *args: List[Element]
(self, *args)
| 8274 | return |
| 8275 | |
| 8276 | def add_row(self, *args): |
| 8277 | """ |
| 8278 | Not recommended user call. Used to add rows of Elements to the Column Element. |
| 8279 | |
| 8280 | :param *args: The list of elements for this row |
| 8281 | :type *args: List[Element] |
| 8282 | """ |
| 8283 | |
| 8284 | NumRows = len(self.Rows) # number of existing rows is our row number |
| 8285 | CurrentRowNumber = NumRows # this row's number |
| 8286 | CurrentRow = [] # start with a blank row and build up |
| 8287 | # ------------------------- Add the elements to a row ------------------------- # |
| 8288 | for i, element in enumerate(args): # Loop through list of elements and add them to the row |
| 8289 | if type(element) == list: |
| 8290 | PopupError('Error creating Column layout', |
| 8291 | 'Layout has a LIST instead of an ELEMENT', |
| 8292 | 'This sometimes means you have a badly placed ]', |
| 8293 | 'The offensive list is:', |
| 8294 | element, |
| 8295 | 'This list will be stripped from your layout', keep_on_top=True, image=_random_error_emoji() |
| 8296 | ) |
| 8297 | continue |
| 8298 | elif callable(element) and not isinstance(element, Element): |
| 8299 | PopupError('Error creating Column layout', |
| 8300 | 'Layout has a FUNCTION instead of an ELEMENT', |
| 8301 | 'This likely means you are missing () from your layout', |
| 8302 | 'The offensive list is:', |
| 8303 | element, |
| 8304 | 'This item will be stripped from your layout', keep_on_top=True, image=_random_error_emoji()) |
| 8305 | continue |
| 8306 | if element.ParentContainer is not None: |
| 8307 | warnings.warn( |
| 8308 | '*** YOU ARE ATTEMPTING TO REUSE AN ELEMENT IN YOUR LAYOUT! Once placed in a layout, an element cannot be used in another layout. ***', |
| 8309 | UserWarning) |
| 8310 | PopupError('Error creating Column layout', |
| 8311 | 'The layout specified has already been used', |
| 8312 | 'You MUST start witha "clean", unused layout every time you create a window', |
| 8313 | 'The offensive Element = ', |
| 8314 | element, |
| 8315 | 'and has a key = ', element.Key, |
| 8316 | 'This item will be stripped from your layout', |
| 8317 | 'Hint - try printing your layout and matching the IDs "print(layout)"', keep_on_top=True, image=_random_error_emoji()) |
| 8318 | continue |
| 8319 | element.Position = (CurrentRowNumber, i) |
| 8320 | element.ParentContainer = self |
| 8321 | CurrentRow.append(element) |
| 8322 | if element.Key is not None: |
| 8323 | self.UseDictionary = True |
| 8324 | # ------------------------- Append the row to list of Rows ------------------------- # |
| 8325 | self.Rows.append(CurrentRow) |
| 8326 | |
| 8327 | def layout(self, rows): |
| 8328 | """ |
nothing calls this directly
no test coverage detected