I can't use the .get()
function anymore for some reason.
Here is my code:
import tkinter
from tkinter import *
def submit():
file = open('database.txt', 'w')
file.write('Username:', un, '\nPassword:', pw)
file.close()
wn = Tk()
wn.geometry('500x200')
Label(text='Geben Sie hier Ihren Benutzername ein:').pack()
username = Entry().pack()
Label(text='\n').pack()
Label(text='Geben Sie hier Ihr Passwort ein:').pack()
password = Entry().pack()
Label(text='\n').pack()
un = str(username.get())
pw = str(password.get())
btn = Button(text='Submit', command=submit).pack()
wn.mainloop()
It used to work in the past, so I don't really know what to do.
The error I get looks like this:
un = str(username.get()) AttributeError: 'NoneType' object has no attribute 'get'