0

https://github.com/ansonallseitz/pythonDrills/blob/master/Liang/ch14/FileEditor.py

I didn't write this code, its from a textbook.

In lines 47-58 there are 2 functions. I understand everything about the functions, accept the use of "END"

I re-read the chapter and I couldn't find out what they were talking about.

    def openFile(self): 
        filenameforReading = askopenfilename()
        infile = open(filenameforReading, "r")
        self.text.insert(END, infile.read())  # <- this "END"
        infile.close()  # Close the input file
    
    def saveFile(self):
        filenameforWriting = asksaveasfilename()
        outfile = open(filenameforWriting, "w")
        # Write to the file
        outfile.write(self.text.get(1.0, END))  # <- and this "END"
        outfile.close() # Close the output file

I read the chapter, and googled. I can't figure out what the heck is going on here.

I mean... I understand its about reading and writing files.

Mike 'Pomax' Kamermans
  • 49,297
  • 16
  • 112
  • 153
Anson.A
  • 3
  • 2

1 Answers1

0

"1.0" here means the start of the text, END or "end" means the end of the text. The .get method asks for starting and the ending points as its arguments.

I recommend checking this: https://dafarry.github.io/tkinterbook/text.htm

acoolguy
  • 66
  • 6