R
R
roma_nikita2020-04-22 13:19:32
Python
roma_nikita, 2020-04-22 13:19:32

PyQt5,Pyside2: How to save data after closing?

I am making a diary app. The user writes his schedule, and the program must remember it.
For the sake of experiment, I filled all the Lineedit widgets with the word "FILL" and wrote this piece of code:

self.monday_64 = QLineEdit(self.monday_main_2)
a = self.monday_64.text()
f = open('text.txt', 'w')
f.write(a)
f.close()

It seems like he remembers and writes to the text. document the word "FILL", but if I enter MY word and close the program, the program will not write MY word.
Who can tell how to do it?
Full code: https://rextester.com/JGHBP98671

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andy_U, 2020-04-23
@Andy_U

Here, we finished with the first question, now we can finish here:
Add the Save button, bind a function to it, where you query your fields, and save the result to a file. Or catch the message from the closing main window. Lots of options, actually.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question