Skip to content
This repository was archived by the owner on May 25, 2022. It is now read-only.

Commit a777e4e

Browse files
authored
Merge pull request #490 from lilo550/password_generator
Adding new project
2 parents a51bac4 + beec439 commit a777e4e

File tree

7 files changed

+51
-0
lines changed

7 files changed

+51
-0
lines changed

.DS_Store

8 KB
Binary file not shown.

projects/.DS_Store

18 KB
Binary file not shown.

projects/Password_generator/.DS_Store

6 KB
Binary file not shown.

projects/Password_generator/README.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Password_generator
2+
This script generate a random password
3+
## Prerequisites
4+
None
5+
## How to run the script
6+
Execute : password_generator.py
7+
## Screenshot/GIF showing the sample use of the script
8+
![](screenshot.png)
9+
## Author Name
10+
lilo550

projects/Password_generator/logo.ico

23.3 KB
Binary file not shown.

projects/Password_generator/logo.png

29.6 KB
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
from tkinter import*
2+
from random import choice
3+
import string
4+
5+
class App:
6+
def __init__(self):
7+
self.window = Tk()
8+
self.window.title('password_generator')
9+
self.window.iconbitmap('logo.ico')
10+
self.window.iconphoto(False, PhotoImage(file='logo.png'))
11+
self.window.geometry('500x255')
12+
self.window.config(bg='gray')
13+
14+
#component creation
15+
self.label()
16+
self.entry()
17+
self.button()
18+
19+
def label(self):
20+
label_title = Label(self.window, text='Welcome to password generator', font=('Courrier', 20), bg='gray', fg='black')
21+
label_title.pack()
22+
23+
def entry(self):
24+
self.password_entry = Entry(self.window, font=('Courrier', 25), bg='white', fg='black', width=30, relief='solid')
25+
self.password_entry.pack(pady=50)
26+
27+
def button(self):
28+
password_generator = Button(self.window, text="Generate_password", font=('Courrier', 12), bg='white', fg='black', width=25, command=self.generate_password)
29+
password_generator.pack()
30+
31+
def generate_password(self):
32+
characters = string.ascii_letters + string.punctuation + string.digits
33+
password = ""
34+
for x in range(28):
35+
password+=choice(characters)
36+
self.password_entry.delete(0, END)
37+
self.password_entry.insert(0, password)
38+
39+
#display
40+
app = App()
41+
app.window.mainloop()

0 commit comments

Comments
 (0)