(May-21-2020, 10:59 PM)menator01 Wrote: Here is a link with example
https://stonesoupprogramming.com/2018/03...le-dialog/
the examples are very clear in that web site, but it doesn't help me to reach my goal. I already explained what I want to do in my last reply:
def __Save(self): # this code creates a file excel named "final_document.xlsx" in the same directory where I run the script. # how can I integrate this kind of code with "filedialog.asksaveasfile()" function? what I want is first # creating the excel file in RAM (without give a specific location) and then, save it where I want and with # the name that I want, using "filedialog.asksaveasfile()" function. the save process must be done via GUI! # how can I reach my goal? # # wb = xw.Workbook("final_document.xlsx") # ws = wb.add_worksheet("RESULT") # ws.write(0, 0, self.first_word) # ws.write(0, 1, self.second_word) # wb.close() #
I understood the "askopenfilename" function but I still don't understand how to save a file already created by my code. my goal is take two or more files with "askopenfilename" function and use a button widget to activate my code (read the input files and create a new file, in my example a file excel). when this process is completed, somthing like "asksaveasfile" function has to ask to the user where to save the new file. from what I understood "asksaveasfile" returns a new file in write mode, but it's not what I want to do. what I want to do is very similar to when you write a word document. when you finished to write, you have to save the document in a directory, and Word asks to you "where do you wanna save your document just written?"