Using Tkinter to export user input to a .csv file
You are on the right track using get(), which will return the contents of a tkinter Entry widget.
I have used a single Entry to illustrate how you can accomplish retreiving text from Entry widgets and writing the contents to a .csv file.
from tkinter import * import csvclass App(Frame): def __init__(self, master=None): Frame.__init__(self, master) self.pack() self.output() def output(self): Label(text='Name:').pack(side=LEFT,padx=5,pady=5) self.e = Entry(root, width=10) self.e.pack(side=LEFT,padx=5,pady=5) self.b = Button(root, text='Submit', command=self.writeToFile) self.b.pack(side=RIGHT,padx=5,pady=5) def writeToFile(self): with open('WorkOrderLog.csv', 'a') as f: w=csv.writer(f, quoting=csv.QUOTE_ALL) w.writerow([self.e.get()])if __name__ == "__main__": root=Tk() root.title('Auto Logger') root.geometry('1000x100') app=App(master=root) app.mainloop() root.mainloop()
By creating the Entry and assigning it to self.e, you are able to access the text value by calling self.e.get() in the App class' writeToFile function.