so i'm trying to make my own login page but i'm running into a error when trying to save the user input into the file. i get a error telling me i cant (.write) a Entry it can only do str. how do i convert or make the entry a str?
from tkinter import *
root = Tk()
#if user clicks submit
def reg():
file = open("login.txt", "a")
file.write(login)
#display login
myLabel = Label(root, text="login")
myLabel.pack()
#creates a user entry
login = Entry(root, textvariable="login")
login.pack()
#submit buttton
Button(root, text="submit", command=reg).pack()
root.mainloop()