Print like Python normally prints except route the output to a multiline element and also add colors if desired :param multiline_element: The multiline element to be output to :type multiline_element: (Multiline) :param args: The arguments to print
(self, *args, end=None, sep=None, text_color=None, background_color=None, autoscroll=None, justification=None, font=None, append=None)
| 4343 | return size |
| 4344 | |
| 4345 | def _print_to_element(self, *args, end=None, sep=None, text_color=None, background_color=None, autoscroll=None, justification=None, font=None, append=None): |
| 4346 | """ |
| 4347 | Print like Python normally prints except route the output to a multiline element and also add colors if desired |
| 4348 | |
| 4349 | :param multiline_element: The multiline element to be output to |
| 4350 | :type multiline_element: (Multiline) |
| 4351 | :param args: The arguments to print |
| 4352 | :type args: List[Any] |
| 4353 | :param end: The end char to use just like print uses |
| 4354 | :type end: (str) |
| 4355 | :param sep: The separation character like print uses |
| 4356 | :type sep: (str) |
| 4357 | :param text_color: color of the text |
| 4358 | :type text_color: (str) |
| 4359 | :param background_color: The background color of the line |
| 4360 | :type background_color: (str) |
| 4361 | :param autoscroll: If True (the default), the element will scroll to bottom after updating |
| 4362 | :type autoscroll: (bool) |
| 4363 | :param font: specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike for the value being updated |
| 4364 | :type font: str | (str, int) |
| 4365 | """ |
| 4366 | end_str = str(end) if end is not None else '\n' |
| 4367 | sep_str = str(sep) if sep is not None else ' ' |
| 4368 | |
| 4369 | outstring = '' |
| 4370 | num_args = len(args) |
| 4371 | for i, arg in enumerate(args): |
| 4372 | outstring += str(arg) |
| 4373 | if i != num_args - 1: |
| 4374 | outstring += sep_str |
| 4375 | outstring += end_str |
| 4376 | if append: |
| 4377 | outstring = self.get() + outstring |
| 4378 | |
| 4379 | self.update(outstring, text_color=text_color, background_color=background_color, font=font) |
| 4380 | |
| 4381 | try: # if the element is set to autorefresh, then refresh the parent window |
| 4382 | if self.AutoRefresh: |
| 4383 | self.ParentForm.refresh() |
| 4384 | except: |
| 4385 | pass |
| 4386 | |
| 4387 | def print(self, *args, end=None, sep=None, text_color=None, background_color=None, justification=None, font=None, colors=None, t=None, b=None, c=None, autoscroll=True, |
| 4388 | append=True): |