Skip to main content
deleted 110 characters in body; edited tags; edited title
Source Link
Tunaki
  • 135.7k
  • 46
  • 357
  • 432

How to detect when the user closes a file?

So I am trying to create a pythonPython program where the user can input text into a file. After they close and save the file, I want to print the contents of the fileits content. How do I detect when the user has saved and closed the file?

This is the code I have used to open the text file.

def opentextbox():
    login = os.getlogin()
    file1 = open('C:/Users/'+login+'/enteryourmessagehere.txt', 'a')
    file1.close()
    subprocess.call(['notepad.exe', 'C:/Users/'+login+'/enteryourmessagehere.txt'])

opentextbox()

What is the code to get the contents of the file after it has been saved and closed? Thanks.

How to detect when the user closes a file?

So I am trying to create a python program where the user can input text into a file. After they close and save the file I want to print the contents of the file. How do I detect when the user has saved and closed the file?

This is the code I have used to open the text file.

def opentextbox():
    login = os.getlogin()
    file1 = open('C:/Users/'+login+'/enteryourmessagehere.txt', 'a')
    file1.close()
    subprocess.call(['notepad.exe', 'C:/Users/'+login+'/enteryourmessagehere.txt'])

opentextbox()

What is the code to get the contents of the file after it has been saved and closed? Thanks.

How to detect when user closes a file?

I am trying to create a Python program where the user can input text into a file. After they close and save the file, I want to print its content. How do I detect when the user has saved and closed the file?

This is the code I have used to open the text file.

def opentextbox():
    login = os.getlogin()
    file1 = open('C:/Users/'+login+'/enteryourmessagehere.txt', 'a')
    file1.close()
    subprocess.call(['notepad.exe', 'C:/Users/'+login+'/enteryourmessagehere.txt'])

opentextbox()
Added python tag, shortened title
Source Link
maxhb
  • 8.8k
  • 9
  • 30
  • 54

How do Ito detect when the user closes a text file?

So I am trying to create a python program where the user can input text into a file. After they close and save the file I want to print the contents of the file. How do I detect when the user has saved and closed the file? 

This is the code I have used to open the text file.

def opentextbox():
    login = os.getlogin()
    file1 = open('C:/Users/'+login+'/enteryourmessagehere.txt', 'a')
    file1.close()
    subprocess.call(['notepad.exe', 'C:/Users/'+login+'/enteryourmessagehere.txt'])

opentextbox()

What is the code to get the contents of the file after it has been saved and closed? Thanks.

How do I detect when the user closes a text file

So I am trying to create a python program where the user can input text into a file. After they close and save the file I want to print the contents of the file. How do I detect when the user has saved and closed the file? This is the code I have used to open the text file.

def opentextbox():
    login = os.getlogin()
    file1 = open('C:/Users/'+login+'/enteryourmessagehere.txt', 'a')
    file1.close()
    subprocess.call(['notepad.exe', 'C:/Users/'+login+'/enteryourmessagehere.txt'])

opentextbox()

What is the code to get the contents of the file after it has been saved and closed? Thanks.

How to detect when the user closes a file?

So I am trying to create a python program where the user can input text into a file. After they close and save the file I want to print the contents of the file. How do I detect when the user has saved and closed the file? 

This is the code I have used to open the text file.

def opentextbox():
    login = os.getlogin()
    file1 = open('C:/Users/'+login+'/enteryourmessagehere.txt', 'a')
    file1.close()
    subprocess.call(['notepad.exe', 'C:/Users/'+login+'/enteryourmessagehere.txt'])

opentextbox()

What is the code to get the contents of the file after it has been saved and closed? Thanks.

Source Link
Rezzy
  • 113
  • 1
  • 2
  • 10

How do I detect when the user closes a text file

So I am trying to create a python program where the user can input text into a file. After they close and save the file I want to print the contents of the file. How do I detect when the user has saved and closed the file? This is the code I have used to open the text file.

def opentextbox():
    login = os.getlogin()
    file1 = open('C:/Users/'+login+'/enteryourmessagehere.txt', 'a')
    file1.close()
    subprocess.call(['notepad.exe', 'C:/Users/'+login+'/enteryourmessagehere.txt'])

opentextbox()

What is the code to get the contents of the file after it has been saved and closed? Thanks.