Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. from tkinter import *
  2. from random import *
  3. import string
  4.  
  5. #Logiciel
  6. def creer_mdp():
  7. password_min = 8
  8. password_max = 15
  9. all_chars = string.ascii_letters + string.punctuation + string.digits
  10. password = "" .join(choice(all_chars) for x in range(randint(password_min, password_max)))
  11. entry.delete(0, END)
  12. entry.insert(0, password)
  13.  
  14. def copy_txt():
  15. file = open("mes_mdp.txt", "a")
  16. file.write("\n"+password)
  17. file.close()
  18.  
  19. #création de fenetre
  20. window = Tk()
  21. window.title("WonderWord")
  22. #taille
  23. window.geometry("1080x720")
  24. window.minsize(1080, 720)
  25.  
  26. #aspect
  27. window.config(background='#2168DD')
  28.  
  29. #frame
  30. frame = Frame(window, bg='#2168DD')
  31. frame1 = Frame(frame, bg='#2168DD')
  32.  
  33. #images
  34. width = 300
  35. height = 300
  36. image = PhotoImage(file="password.png").zoom(15).subsample(32)
  37. canvas = Canvas(frame, width=width, height=height, bg='#2168DD', bd=0, highlightthickness=0)
  38. canvas.create_image(width/2, height/2, image=image)
  39. canvas.grid(row=0, column=0, sticky=W)
  40. #Titre
  41. label = Label(frame1, text="PASSWORD", font=("Helvetica", 30), bg='#2168DD', fg='white')
  42. label.pack()
  43.  
  44. #champ
  45. entry = Entry(frame1, font=("Helvetica", 30), bg='#2168DD', fg='white')
  46. entry.pack()
  47.  
  48. #bouton
  49. button = Button(frame1, text="Generate", font=("Courrier", 30), bg='#2168DD', fg='white', command=creer_mdp)
  50. button.pack(fill=X)
  51.  
  52. copy = Button(frame1, text=".TXT", font=("Courrier", 30), bg='#00C533', fg='white', command=copy_txt)
  53. copy.pack()
  54.  
  55.  
  56. frame.pack(expand=YES)
  57. frame1.grid(row=0, column=1, sticky=W)
  58. #icon
  59. window.iconbitmap("logo.ico.ico")
  60. #affichage
  61. window.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement