By Tanmoyee Roy
Password Vault is a software that allows us to securely store all our passwords and keep them safe and is made using python programming language along with Tkinter, openpyxl, and xlrd libraries.
Password Vault or rather a password manager is a software where we can store all our passwords safely and can view them. In this project, we will be having a GUI window wherein we need to enter some data like the application name for which we want to save our password, the application URL so that we don't need to remember that also and the password itself. After entering all the required details as mentioned, when we click on the submit button, a CSV file or an excel sheet is created in which the entered details got stored. As we keep on entering more passwords using the application, the CSV file gets appended. In this project, we have built a very simple and basic version of a password manager.
We have used libraries such as Tkinter, openpyxl, and xlrd. Tkinter is used for creating GUI applications in a fast and efficient way. Moreover, it provides an object-oriented interface to the GUI. Openpyxl is work with excel files without dealing with third-party application software. We can easily read and write excel files using this module. Xlrd is a module that allows the user to retrieve data from a spreadsheet. Openpylib and xlrd do not come with python which means the user has to manually install them using the pip command i.e:
pip install openpylib
pip install xlrd
Tkinter comes along with python. So no need to install it manually. Then we have imported the workbook class from the openpyxl module to grab the active worksheet. It is the container for all other parts of the document. And finally, we have to import the pathlib library to gather the necessary functionality in one place. It is also a module that comes under python's standard utility modules. Now let's head on to see how to code this project in a step by step manner.
The first job is to import all the necessary libraries which have been mentioned already.
After importing all the necessary libraries and classes, we create the basic framework of the password vault's GUI using Tkinter by mentioning the title of the window, the dimension of the window, the background color, and highlight thickness.
Now, we will be creating the CSV file if it does not exists using the path class of the pathlib module. The path is the main object to work with files. Here our CSV file name is Passwords.
Here there can be confusion that each time we run the program, will new CSV files will be created? The answer has to be no. And to make the answer no we have to specify the condition that if the file is present in that directory then it will simply append the file. Otherwise, it will create the file by mentioning the file column titles and after its creation, it will get saved automatically by the name Passwords.xlsx. Here, the file name is Passwords.xlsx which will be created automatically.
Now we will be writing a function "show" whose function will be showing the password that we have entered when the check box will be checked and hide it otherwise using the "*" symbol because by default passwords are viewed using this symbol while entering.
It's time to make the frame. Here we will be mentioning what all will be asked to the user to enter to save them in the CSV file. In our case, those are Application Name, Application URL, and the password for them. We will also be mentioning the alignments and padding between the entries and the text boxes.
Next, we need to create the entry boxes alongside the text displayed.
We have to make a checkbox also which will be alongside the password textbox.
Let's now make the submit button and run the Tkinter event loop using mainloop.
The only thing that we are now left with is the submit function which will be invoked when Submit button will be clicked. It will store the data entered by the user in the spreadsheet under the correct column name.
We are done without code. When compiled, the output is something like:
Submitted by Tanmoyee Roy (Tanmoyee99)
Download packets of source code on Coders Packet