def opentextbox():
    login = os.getlogin()
subprocess.check_output(['notepad.exe', os.path.join('C:/Users', login,
    'enteryourmessagehere.txt')])
file1 = open('enteryourmessagehere.txt', 'r')
contents = file1.read()
print(contents)
How to detect when user closes a file?