From f220d749de62d0a17e7ac9b3f69bc62e96c752c4 Mon Sep 17 00:00:00 2001 From: PySimpleGUI Date: Fri, 27 Mar 2020 16:45:35 -0400 Subject: [PATCH] Corrected sep string handling for Print and Multiline.print --- PySimpleGUI.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 11dd805c..e03083ec 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -11435,8 +11435,12 @@ class _DebugWin(): # print(f'Printing {ObjToStringSingleObj(self.output_element)}') if self.do_not_reroute_stdout: outstring = '' - for arg in args: - outstring += str(arg) + sepchar + num_args = len(args) + sep_str = str(sep) if sep is not None else ' ' + for i, arg in enumerate(args): + outstring += str(arg) + if i != num_args - 1: + outstring += str(sep_str) outstring += endchar self.output_element.Update(outstring, append=True, text_color_for_value=text_color, background_color_for_value=background_color) else: @@ -11534,8 +11538,13 @@ def _print_to_element(multiline_element, *args, end=None, sep=None, text_color=N endchar = end if end is not None else '\n' outstring = '' - for arg in args: - outstring += str(arg) + sepchar + num_args = len(args) + sep_str = str(sep) if sep is not None else ' ' + for i, arg in enumerate(args): + outstring += str(arg) + if i != num_args-1: + outstring += str(sep_str) + outstring += endchar multiline_element.update(outstring, append=True, text_color_for_value=text_color, background_color_for_value=background_color)