I am working on creating a python Tk program and found that saving files is annoying. I have an open button and a save button. For example I call
file = tkFileDialog.askopenfile(mode='rb',title='Select a file')
from this function
def open_command(self):
In another function
def save_file(self):
I want to save the file. To save the file under the same name I have to call
file = tkFileDialog.asksaveasfile(mode='w')
again and this opens another window, then it asks you to name the file, and finaly prompts you if you want to overwrite the file. Is there a way to save the file without any windows? Is it possible in any way to not close the file in one function and then write to the file and save it in another function?