In this tutorial, we will be creating a simple application that can randomly generate strong passwords using the Python Tkinter module.
STEPS:
1) Importing Tkinter module and importing random module.
from tkinter import * from random import randint
2) Creating the main window.
A window is an instance of tkinter’s Tk class.
Set the dimension and title.
window=Tk()
3) Create a LabelFrame and add an Entry widget to it. This Entry widget will hold the number of characters we want in our password.
4) Create a Label widget and add it to the window. This will be used to display the output.
5) Create a newFrame and add a button widget to this frame.
#creating a new frame newFrame=Frame(window) newFrame.pack(pady=10)
6) Associate a callback function with an event using the command binding. This function will generate a new password.
generateBtn=Button(newFrame,text="Generate ", command=generatePass) generateBtn.grid(row=0,column=0,padx=10,pady=10)
Submitted by Sumedha Kulkarni (Sumedha)
Download packets of source code on Coders Packet
Comments