forked from fenyx-it-academy/Class4-PythonModule-Week4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPasswordGen.py
More file actions
33 lines (21 loc) · 1.02 KB
/
PasswordGen.py
File metadata and controls
33 lines (21 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import random
import string
from tkinter import *
from tkinter.ttk import *
root = Tk()
root.title("Password Generator App")
root['background']='#856ff8'
root.geometry("450x450")
pass_str = StringVar()
def generate(): # 2'ser tane buyuk harf, rakam ve karakteri seciyoruz, toplam 6 ediyor
random_source = string.ascii_letters + string.digits + string.punctuation
password = random.choice(string.ascii_uppercase) + random.choice(string.ascii_uppercase)
password += random.choice(string.digits) + random.choice(string.digits)
password += random.choice(string.punctuation) + random.choice(string.punctuation)
for i in range(4): #kalan 4 karakteri yukaridaki kumeden aliyorum
password += random.choice(random_source)
pass_str.set(password)
Label(root, text="Password Generator Application", font="Lucida 20 bold").pack()
Button(root, text="Generate Password", command=generate).pack(pady=7)
Entry(root, textvariable=pass_str).pack(pady=2)
root.mainloop()