Coders Packet

Random Password Generator using Python Tkinter

By Sumedha Kulkarni

In this tutorial, we will be creating a simple application that can randomly generate strong passwords using the Python Tkinter module.


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.



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


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)


Download Complete Code


No comments yet