1 changed files with 200 additions and 0 deletions
@ -0,0 +1,200 @@ |
|||||
|
from tkinter import * |
||||
|
from random import randint |
||||
|
from threading import Thread |
||||
|
from time import sleep |
||||
|
from winsound import * |
||||
|
|
||||
|
class Visage: |
||||
|
def __init__(self,uncolor,uncanvas,unx,uny,uncoef): |
||||
|
self.c=uncanvas |
||||
|
self.color=uncolor |
||||
|
self.x=unx |
||||
|
self.y=uny |
||||
|
self.coef=uncoef |
||||
|
###################Création des yeux############# |
||||
|
eye_y=20 |
||||
|
self.eye_1=self.c.create_oval(self.x+10+self.coef, |
||||
|
self.y+eye_y, |
||||
|
self.x+30+self.coef, |
||||
|
self.y+eye_y+20, |
||||
|
fill=self.color) |
||||
|
eye_2_x=40 |
||||
|
self.eye_2=self.c.create_oval(self.x+eye_2_x+self.coef, |
||||
|
self.y+eye_y, |
||||
|
self.x+eye_2_x+20+self.coef, |
||||
|
self.y+eye_y+20, |
||||
|
fill=self.color) |
||||
|
|
||||
|
###################Création du visage et bouche############# |
||||
|
self.vis=self.c.create_oval(self.x+self.coef, |
||||
|
self.y, |
||||
|
self.x+70+self.coef, |
||||
|
self.y+70) |
||||
|
|
||||
|
self.sourir=self.c.create_arc(self.x+10+self.coef, |
||||
|
self.y+30, |
||||
|
self.x+60+self.coef, |
||||
|
self.y+60, |
||||
|
start=0, |
||||
|
extent=-180, |
||||
|
style=ARC, |
||||
|
width=3) |
||||
|
|
||||
|
def change_color(self,color): |
||||
|
self.c.itemconfigure(self.sourir,outline=color) |
||||
|
self.c.itemconfigure(self.vis,outline=color) |
||||
|
self.c.itemconfigure(self.eye_1,outline=color) |
||||
|
self.c.itemconfigure(self.eye_2,outline=color) |
||||
|
|
||||
|
class Idiot: |
||||
|
def __init__(self,uncolor,uncanvas,unx,uny): |
||||
|
self.x=unx |
||||
|
self.y=uny |
||||
|
self.color=uncolor |
||||
|
self.c=uncanvas |
||||
|
self.fond=self.c.create_rectangle(0,0,455,605) |
||||
|
self.idiot_text=self.c.create_text((225, 15), fill="#000000", text="You are an idiot",font= 'Impact 20') |
||||
|
##########################Création des trois visages################### |
||||
|
self.idiot_1=Visage(self.color,self.c,self.x,self.y,0) |
||||
|
self.idiot_2=Visage(self.color,self.c,self.x,self.y,150) |
||||
|
self.idiot_3=Visage(self.color,self.c,self.x,self.y,300) |
||||
|
|
||||
|
def change_color(self,color): |
||||
|
if color=="#ffffff": |
||||
|
self.c.configure(bg="#000000") |
||||
|
else: |
||||
|
self.c.configure(bg="#ffffff") |
||||
|
self.c.itemconfigure(self.idiot_text ,fill=color) |
||||
|
self.idiot_1.change_color(color) |
||||
|
self.idiot_2.change_color(color) |
||||
|
self.idiot_3.change_color(color) |
||||
|
|
||||
|
class Anim_idiot(Thread): |
||||
|
def __init__(self,vis): |
||||
|
Thread.__init__(self) |
||||
|
self.idiot=vis |
||||
|
|
||||
|
def run(self): |
||||
|
while True: |
||||
|
self.idiot.change_color("#000000") |
||||
|
sleep(0.5) |
||||
|
self.idiot.change_color("#ffffff") |
||||
|
sleep(0.5) |
||||
|
|
||||
|
def gen_password(): |
||||
|
lst_c_sp="""&àç_-èé"*§@µ^¨$£=,.œ""" |
||||
|
lst_let="azertyuiopqsdfghjkwlxmcvbn" |
||||
|
lst_numb="1230456789" |
||||
|
|
||||
|
nb_c_sp_mp=nb_c_sp.get() |
||||
|
nb_maj_mp=nb_maj.get() |
||||
|
nb_chif_mp=nb_chif.get() |
||||
|
nb_car_mp=nb_car.get() |
||||
|
nb_let_mp=nb_car_mp-(nb_c_sp_mp+nb_maj_mp + nb_chif_mp) |
||||
|
|
||||
|
password="" |
||||
|
lst_car_tir=[0,1,2,3] |
||||
|
#C'est moche. Regarde les caractère non utilisé |
||||
|
if nb_c_sp_mp==0: |
||||
|
lst_car_tir.remove(0) |
||||
|
if nb_maj_mp==0: |
||||
|
lst_car_tir.remove(1) |
||||
|
if nb_chif_mp==0: |
||||
|
lst_car_tir.remove(2) |
||||
|
if nb_let_mp ==0: |
||||
|
lst_car_tir.remove(3) |
||||
|
|
||||
|
if nb_c_sp_mp+nb_maj_mp + nb_chif_mp<=nb_car_mp: |
||||
|
while nb_chif_mp!=0 or nb_c_sp_mp!=0 or nb_chif_mp !=0 or nb_car_mp!=0: |
||||
|
car_aj=lst_car_tir[randint(0,len(lst_car_tir)-1)]#prend un caractère aux hasard parmi ceux réstant |
||||
|
|
||||
|
if car_aj==0 and nb_c_sp_mp>0: |
||||
|
password=password+lst_c_sp[randint(0,len(lst_c_sp)-1)] |
||||
|
nb_c_sp_mp=nb_c_sp_mp-1 |
||||
|
nb_car_mp=nb_car_mp-1 |
||||
|
if nb_c_sp_mp==0: |
||||
|
lst_car_tir.remove(0) |
||||
|
|
||||
|
elif car_aj==1 and nb_maj_mp>0: |
||||
|
password=password+lst_let[randint(0,25)].upper() |
||||
|
nb_maj_mp=nb_maj_mp-1 |
||||
|
nb_car_mp=nb_car_mp-1 |
||||
|
if nb_maj_mp==0: |
||||
|
lst_car_tir.remove(1) |
||||
|
|
||||
|
elif car_aj==2 and nb_chif_mp>0: |
||||
|
password=password+lst_numb[randint(0,9)] |
||||
|
nb_chif_mp=nb_chif_mp-1 |
||||
|
nb_car_mp=nb_car_mp-1 |
||||
|
if nb_chif_mp==0: |
||||
|
lst_car_tir.remove(2) |
||||
|
|
||||
|
|
||||
|
elif car_aj==3 and nb_let_mp>0: |
||||
|
password=password+lst_let[randint(0,25)] |
||||
|
nb_let_mp=nb_let_mp-1 |
||||
|
nb_car_mp=nb_car_mp-1 |
||||
|
if nb_let_mp==0: |
||||
|
lst_car_tir.remove(3) |
||||
|
lab_mot_de_passe.config(text="Mot de passe:"+password) |
||||
|
else: |
||||
|
you_are_an_idiot() |
||||
|
|
||||
|
def mot_de_passe_hash(password): |
||||
|
fich_pasw=open("Fichier_de_mot_de_passe_hasher.txt","w") |
||||
|
fich_pasw.write(str(hash(password))) |
||||
|
|
||||
|
def you_are_an_idiot(): |
||||
|
fenetre_idiot=Tk() |
||||
|
fenetre_idiot.title("You are an idiot") |
||||
|
fenetre_idiot.protocol("WM_DELETE_WINDOW",double) |
||||
|
fenetre_idiot.grid() |
||||
|
idiot_can=Canvas(fenetre_idiot, width=450, height=100,bg="#ffffff") |
||||
|
idiot_can.grid(row=1,column=1) |
||||
|
idiot_var=Idiot("#000000",idiot_can,20,30) |
||||
|
idiot_anime=Anim_idiot(idiot_var) |
||||
|
idiot_anime.start() |
||||
|
|
||||
|
fenetre_idiot.mainloop() |
||||
|
|
||||
|
def double(): |
||||
|
you_are_an_idiot() |
||||
|
you_are_an_idiot() |
||||
|
|
||||
|
fenetre=Tk() |
||||
|
fenetre.title("Créateur de mot de passe") |
||||
|
fenetre.configure(bg = "#3356ff") |
||||
|
fenetre.grid() |
||||
|
###########Nombre de majuscule############## |
||||
|
lab_nb_maj=Label(text="Nombre de majuscule",bg="#3356ff") |
||||
|
lab_nb_maj.grid(row=1,column=1,padx=3) |
||||
|
nb_maj=IntVar() |
||||
|
entry_nb_maj=Entry(textvariable=nb_maj,bd=5) |
||||
|
entry_nb_maj.grid(row=2,column=1,padx=3) |
||||
|
|
||||
|
#######Nombre de caractère speciaux######### |
||||
|
lab_nb_c_sp=Label(text="Nombre de caractères spéciaux",bg="#3356ff") |
||||
|
lab_nb_c_sp.grid(row=1,column=2,padx=3) |
||||
|
nb_c_sp=IntVar() |
||||
|
entry_nb_c_sp=Entry(textvariable=nb_c_sp,bd=5) |
||||
|
entry_nb_c_sp.grid(row=2,column=2,padx=3) |
||||
|
|
||||
|
##############Nombre de chiffre############# |
||||
|
lab_nb_chif=Label(text="Nombre de chiffres",bg="#3356ff") |
||||
|
lab_nb_chif.grid(row=1,column=3,padx=3) |
||||
|
nb_chif=IntVar() |
||||
|
entry_nb_chif=Entry(textvariable=nb_chif,bd=5) |
||||
|
entry_nb_chif.grid(row=2,column=3,padx=3) |
||||
|
|
||||
|
#############Nombre de caractère########### |
||||
|
lab_nb_car=Label(text="Nombre de caractères",bg="#3356ff") |
||||
|
lab_nb_car.grid(row=1,column=4,padx=5) |
||||
|
nb_car=IntVar() |
||||
|
entry_nb_car=Entry(textvariable=nb_car,bd=5) |
||||
|
entry_nb_car.grid(row=2,column=4,padx=5) |
||||
|
################################### |
||||
|
buton_mot_de_passe=Button(text="Creer mot de passe",command=gen_password) |
||||
|
buton_mot_de_passe.grid(row=4,column=1,columnspan=4) |
||||
|
lab_mot_de_passe=Label(text="Mot de passe:",bg="#3356ff") |
||||
|
lab_mot_de_passe.grid(row=5,column=1,columnspan=4) |
||||
|
fenetre.mainloop() |
Loading…
Reference in new issue