I'm not sure if I am blind or stupid or what but I keep getting the error for
done_button = tkinter.Button(window2, text="Done!", command=add_pass(platform,phone,email,user,password))
Error:
Traceback (most recent call last):
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\tkinter\__init__.py", line 1921, in __call__
return self.func(*args)
File "C:\Users\Admin\Desktop\GUI\main.py", line 37, in add
done_button = tkinter.Button(window2, text="Done!", command=add_pass(platform,phone,email,user,password))
TypeError: 'Button' object is not callable
I'm not sure what to do here or what to try but I feel like I hit a dead end.
Code:
def add():
window2 = tkinter.Tk()
window2.title("Chase's Password Manager")
plat_label = tkinter.Label(window2,text="Platform:")
platform = tkinter.Entry(window2)
phone_label = tkinter.Label(window2,text="Phone:")
phone = tkinter.Entry(window2)
email_label = tkinter.Label(window2,text="Email:")
email = tkinter.Entry(window2)
name_label = tkinter.Label(window2,text="Name:")
user = tkinter.Entry(window2)
pass_label = tkinter.Label(window2,text="Password:")
password = tkinter.Entry(window2)
done_button = tkinter.Button(window2, text="Done!", command=add_pass(platform,phone,email,user,password))
plat_label.pack()
platform.pack()
phone_label.pack()
phone.pack()
email_label.pack()
email.pack()
name_label.pack()
user.pack()
pass_label.pack()
password.pack()
done_button.pack()
If you want the definition of "add_pass", here it is.
def add_pass(platform, phone, email, user, password):
with open('passwords.txt', 'w') as f:
f.write(f"{platform} | {phone} | {email} | {user} | " + fernet.encrypt(password.encode()).decode() + "\n")