'PySimpleGui save Multiline as .txt
I want to save Multiline (PySimpleGui) as .txt.
[sg.Multiline(
enter_submits=True,
key='_LOG_'
))]
The program writes into it
window['_LOG_'].print('something')
and when it's done it should automatically save it as .txt.
Solution 1:[1]
You can use your key for this. Like:
import io
with io.open("data.txt", "w", encoding="utf8") as f:
f.write(values['_LOG_'])
f.close()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Arthur Rodrigues |
