I am trying to dynamically display rows in the UI when a button is pressed.
To do this, I am first declaring the row in the layout, but making it hidden. Then when I get the value, I make the row hidden.
Sometimes the text is very large, so I am using the textwrap's fill method in python. So this gives me text with 2 to 3 rows.
But when I try to, each character appears in different rows.
disp_text = "Text:\n{}".format(textwrap.fill(some_text,70))
size = (70,disp_text.count("\n")+1)
window['-TEXT-'].set_size(size)
window['-TEXT-'].update(value = disp_text,visible = True)
Assume some_text
is "Hello how are you....(and some 50 other characters)"
Now, with the above string, the size
is (70,3)
So, ideally it should wrap some_text
into 3 lines.
But the actual output in the GUI is:
H
e
l
Which is basically the first 3 characters in some_text
in 3 seperate lines instead of some_text
as a while in 3 different lines.
How does one fix this?