Psswrdmnger 2
Psswrdmnger 2
Import mysql.connector
Class DatabaseMediator:
“””
Args:
“””
Try:
Self.host = host
Self.user = user
Self.password = password
Self.database = database
Self.table_name = table_name
Self.columns = columns
Self.mydb = mysql.connector.connect(
Host=self.host,
User=self.user,
Password=self.password,
Database=self.database
Self.mycursor = self.mydb.cursor()
Except Exception:
“””
Args:
“””
Try:
Self.mydb.commit()
Except Exception:
Def retrieve_data(self):
“””
Returns:
List: A list of tuples representing the retrieved data.
“””
Try:
Myresult = self.mycursor.fetchall()
Return myresult
Except Exception:
Class PasswordManager(CTk):
Def __init__(self):
Super().__init__()
Self.title(“Password Manager”)
Self.frame = CTkFrame(self)
Self.account_name.pack(padx=10, pady=10)
Self.account_id = CTkEntry(self.frame, placeholder_text=”Enter your
user ID here”)
Self.account_id.pack(padx=10, pady=10)
Self.account_password.pack(padx=10, pady=10)
Def save(self):
Acc_nm = self.account_name.get()
Acc_id = self.account_id.get()
Acc_password = self.account_password.get()
Def view(self):
Passwords = self.database_connection.retrieve_data()
Result = “”
For I in range(len(passwords)):
Result_frame = CTkFrame(self)
Res_label.pack()
App = PasswordManager()
App.mainloop()