forked from fenyx-it-academy/Class4-PythonModule-Week4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPassword Generator
More file actions
53 lines (44 loc) · 1.48 KB
/
Password Generator
File metadata and controls
53 lines (44 loc) · 1.48 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# 1- Random Password
import tkinter as tk
import random
def sifre():
#fonksiyon karakterlerin ascii kodlarini random olarak secip, daha sonra bunlari random olarak biraraya getirme uzerine kurulu
liste=[]
for i in range(10):
if i<2:
a=random.randrange(65,90)
liste.append(a)
elif 1<i<4:
b=random.randrange(48,57)
liste.append(b)
elif 3<i<6:
c=random.randrange(33,47)
liste.append(c)
elif 5<i<10:
d=random.randrange(33,122)
liste.append(d)
yeni_liste=[]
digits = [0,1,2,3,4,5,6,7,8,9]
for i in range(10):
n=random.choice(digits)
digits.remove(n)
yeni_liste.append(liste[n])
sifre=""
for i in range(10):
sifre+=chr(yeni_liste[i])
etiket = tk.Label(form, text=sifre, fg="black", bg="blue",font="Times 15 bold")
etiket.pack(fill=tk.X)
form=tk.Tk()
form.title("Random Password Generator")
form.geometry("600x600+400+100")
form.configure(bg="yellow")
form.resizable(False,True)
label=tk.Label(form,text="Random Password Generator",fg="red",font="Times 15 bold")
label.pack()
label1=tk.Label(form,text="Password will contain at least 2 upper case letter, 2 digits and 2 special symbols.",fg="red",font="Times 12 bold")
label1.pack()
buton=tk.Button(form,text="Click for a password", fg="red", font="Times 15 bold", command=sifre)
buton.pack()
form.state("normal")
form.wm_attributes("-alpha",0.8)
form.mainloop()