By Mihir Shri
This project is about creating a random password generator in Python 3 using Tkinter. Just give the length of the password you want to generate and you'll get a random password.
This project creates a random password generator.
The user needs to enter:
1. The length of the password to be generated.
The output has been produced in GUI form using the Tkinter library in Python which is the standard Python interface to the Tk GUI toolkit. The user is prompted to an 800x600 window with two text boxes, one for the input (entering the length) and the other for the output (the generated password).
The output window has been created using the Tk().geometry("AxB") function which takes a string as a parameter and the string should be of the form "AxB", where A is the width of the screen, x is lowercase "x" and B is the height of the screen.
The actual password is created using the random library in Python which a library used for generating/selecting random numbers or elements. A list containing uppercase and lowercase letters (A-Z and a-z), numbers (0-9) and special symbols (!, @, #, $, %, ^, &, *, (, )) was created and the random.choice() function was used to (which takes in the list as a parameter) choose a character from the list and this was repeated the desired number of times.
An additional feature of Copy to clipboard has also been provided because the generated password is random and it will be very difficult to remember it. So, click on the "copy to clipboard" button and the password gets copied to your clipboard.
This has been implemented using the pyperclip library in Python which is a cross-platform Python module for copy and paste clipboard functions. The pyperclip.copy("string") function takes a string as an argument and copies it to the clipboard.
The different text areas and buttons have been created using Tk().Entry() and Tk().Button() respectively by passing in appropriate parameters. The text labels have been created using Tk().Label() function. Tk().mainloop() function has been used to run the program indefinitely without terminating unless the user closes the GUI screen.
Note: The user first needs to install the "Tkinter" library and "pyperclip" library by using "pip install Tkinter" or "pip install pyperclip" or read their official documentation if not using pip.
Submitted by Mihir Shri (coe18b064)
Download packets of source code on Coders Packet
Comments