So I have this program that grabs a text file from the internet, reads it and then set the decoded text to an element.
import PySimpleGUI as sg
import urllib.request
data = urllib.request.urlopen("link to a text file")
layout = [[sg.Text('', k='textElement')]]
window = sg.window('Foo', layout)
def setText(Text):
for line in Text:
decodedText = line.decode("utf-8")
window['textElement'].update(value=decodedText)
setText(data)
while True:
event, values = window.read()
if event == sg.WIN_CLOSED:
break
window.close()
Something like that. But instead it only displays the last line of the text file.