Skip to main content

Password Generator (GUI)

Google gives you suggestions when you create your new passwords Right!

In the same way, python makes it too easy for you to create your own password generator rather than using other tools like google.

We are providing you the full source code with the explanation at every line which we are sure will help you.




# importing the tkinter module from tkinter import * # importing the pyperclip module to use it to copy our generated # password to clipboard import pyperclip # random module will be used in generating the random password import random # initializing the tkinter root = Tk() # setting the width and height of the gui root.geometry("400x400") # x is small case here # declaring a variable of string type and this variable will be # used to store the password generated passstr = StringVar() # declaring a variable of integer type which will be used to # store the length of the password entered by the user passlen = IntVar() # setting the length of the password to zero initially passlen.set(0) # function to generate the password def generate(): # storing the keys in a list which will be used to generate # the password pass1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', ' ', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')'] # declaring the empty string password = "" # loop to generate the random password of the length entered # by the user for x in range(passlen.get()): password = password + random.choice(pass1) # setting the password to the entry widget passstr.set(password) # function to copy the password to the clipboard def copytoclipboard(): random_password = passstr.get() pyperclip.copy(random_password) # Creating a text label widget Label(root, text="Password Generator Application", font="calibri 20 bold").pack() # Creating a text label widget Label(root, text="Enter password length").pack(pady=3) # Creating a entry widget to take password length entered by the # user Entry(root, textvariable=passlen).pack(pady=3) # button to call the generate function Button(root, text="Generate Password", command=generate).pack(pady=7) # entry widget to show the generated password Entry(root, textvariable=passstr).pack(pady=3) # button to call the copytoclipboard function Button(root, text="Copy to clipboard", command=copytoclipboard).pack() # mainloop() is an infinite loop used to run the application when # it's in ready state root.mainloop()




Comments

Popular posts from this blog

INSTALLING PYTHON (Anaconda)

 IN WINDOWS :  Download the Anaconda installer (TIP : IF IMAGES ARE BLURRED , TAP ON THEM FOR FULL SCREEN IMAGE) 1] Click the link the download will be started! 2]  Double click the downl oaded file to launch. 3] Click NEXT 4]  Read the licensing terms and click “I Agree”. 5] Select an install for “Just Me” 6] Select a destination folder to install Anaconda and click the Next button   7] Choose whether to add Anaconda to your PATH environment variable. We recommend not adding Anaconda to the PATH environment variable, since this can interfere with other software. Instead, use Anaconda software by opening Anaconda Navigator or the Anaconda Prompt from the Start Menu. 8] Choose whether to register Anaconda as your default Python. Unless you plan on installing and running multiple versions of Anaconda or multiple versions of Python, accept the default and leave this box checked 9] Click the Install button. If you want to watch the packages Anaconda is installing, c...

Url Shortener Project Using Python

  What you need Basics of python knowledge on Dictionary and functions knowledge on Classes and objects.        OK!! HERE IS THE CODE 😊                 import random import string     def create_shortURL(link):             chars = string.ascii_lowercase      # chars = ['a','c','z']      short_url = ''.join(random.choice(chars) for i in range ( 5 ))      d = {}      URL = 'https://www.plc.ly/' + short_url # PLC = Python Learn Camp             d[URL] = link            # This is optional        if URL in d:          print ( 'Your URL:' ,d[URL])          print ( 'Shorten URL:' ,URL) ...

Key Logger

Check Out Our Instagram Page :  Instagram.com/Python.Coderss   What is a keylogger:   A keylogger (short for keystroke logger) is software that tracks or logs the keys struck on your keyboard, typically in a covert manner so that you don’t know that your actions are being monitored. This is usually done with malicious intent to collect your account information, credit card numbers, user names, passwords, and other private data. Legitimate uses do exist for keyloggers. Parents can monitor their children’s online activity or law enforcement may use it to analyze and track incidents linked to the use of personal computers, and employers can make sure their employees are working instead of surfing the web all day. Nevertheless, keyloggers can pose a serious threat to users, as they can be used to intercept passwords and other confidential information entered via the keyboard. As a result, cybercriminals can get PIN codes and account numbers for your financial accounts, passwo...