Use dialog window to capture entered text with Python Gtk.entry

A dozen examples and only one showed how to actually retrieve the text that was entered, how to take the entry text and close the dialog when the enter key is pressed.

gtk entry window ctr+z undo text change

Allegedly: Not going to happen in GTK3, but already in GTK4: https://gitlab.gnome.org/GNOME/gtk/-/issues/1690

Background, i guess: https://wiki.gnome.org/Projects/GTK/Undo

python first row of CSV if not exists

For this, you just have to check the file manually, there’s sadly no helper method in Python’s CSV writer and surprisingly few people seem to be trying to do the same thing.

if not os.path.isfile(filepath):
    with open(filepath, 'w', newline='') as csvfile:
        log = csv.writer(csvfile)
        log.writerow(['started', 'recorded', 'description', 'intention'])

with open(filepath, 'a', newline='') as csvfile:
    log = csv.writer(csvfile)
    log.writerow([start, end, whatdid, whatnext])