کدنویس۲۱

کدنویس۲۱

با کد نویس 21 کد نویس باشید.
کدنویس۲۱

کدنویس۲۱

با کد نویس 21 کد نویس باشید.

ایجاد برنامه رمز ساز با پایتون

سلام دوستان امروز می خواهم یک برنامه رمز ساز با tkinter در پایتون برایتان بگذارم و کم کم ساخت برنامه های گرافیکی(GUI) با پایتون را شروع کنیم.

 

 

این کد را فقط برای آشنایی گذاشتم و توضیحی راجع به آن نمی دهم.

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
#Python 3 #Mehrad Pooryoussof #www.CodeWriter21.blogsky.com from tkinter import * from tkinter.scrolledtext import ScrolledText import random Form = Tk() Form.title("CodeWriter21 Password Maker") label=Label(Form,text="Enter your name in English.") label.grid(row=1,column=0) Name=Entry(Form) Name.grid(row=1,column=1) label2=Label(Form,text="Enter the length of your wanted password.") label2.grid(row=1,column=2) length=Entry(Form) length.grid(row=1,column=3) def showpass(): outPass= Name.get() if len(outPass)>0: outPass=outPass.replace("a","@") outPass=outPass.replace("I","1") outPass=outPass.replace("l","I") outPass=outPass.replace("o","0") outPass=outPass.replace("p","b") outPass=outPass.replace("q","p") outPass=outPass.replace("M","W") outPass=outPass.replace("w","M") outPass=outPass.replace("E","3") outPass=outPass.replace("F","6") outPass=outPass.replace("c","o") outPass=outPass.replace("e","c") outPass=outPass.replace("N","Z") outPass=outPass+"_"+str(random.randint(100,10000)) m=len(outPass) try: n=int(length.get()) if m<n: outPass=outPass+str(random.randint(10**(n-m),10**(n-m)*9)) output=Label(Form,text=outPass) output.grid(row=2,column=1) except: print("Error") else: output=Label(Form,text="Please enter your name") output.grid(row=2,column=1) GetPass=Button(Form,text="Show me",command=showpass) GetPass.grid(row=2,column=0) Form.mainloop()

خودتون ببینید و استفاده کنید.

تا تکه کدی دیگر خداحافظ

نظرات 0 + ارسال نظر
برای نمایش آواتار خود در این وبلاگ در سایت Gravatar.com ثبت نام کنید. (راهنما)
ایمیل شما بعد از ثبت نمایش داده نخواهد شد