Browse Source

fonction de génération de mot de passe crée bug lent +mot de passe vide

master
mathis.philippot 2 weeks ago
parent
commit
c45c0a693c
  1. 65
      Ballon/b allon.py
  2. 446
      Ballon/ballon(chelou(tu vas pas commprendre Mathis -toi du passé)).py
  3. 89
      Ballon/ballon_et_carré_télé.py
  4. 126
      Ballon/ballon_tele.py
  5. 48
      mot_de_passe.py

65
Ballon/b allon.py

@ -0,0 +1,65 @@
from tkinter import *
from math import sqrt
from math import inf
from random import randint
x=randint (0,1500)
y=randint (0,500)
def puissance(x,b):
r=1
while b>0:
if b//2==1:
r=r*x
x=x*x
b=b//2
return r
def tiragecouleur():
hexa=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"]
couleurhexa="#"
for i in range(6):
n=randint(0,15)
couleurhexa=couleurhexa+hexa[n]
return couleurhexa
def reactionclick (event):
trouvé=False
global x,y
l.configure(text="T'es au niveau de Arno en code" )
for i in range (0,len(listx)):
if sqrt( (event.x - (listx[i]+100))**2 + (event.y -(listy[i]+100))**2) < 100 :
x=randint (0,1999)
y=randint (0,999)
c.coords(listr[i],x,y,x+200,y+200)
listx[i]=x
listy[i]=y
global x3, y3
x3=randint (0,2000)
y3=randint (0,1000)
r3=c.create_oval(x3,y3,x3+200,y3+200,fill=tiragecouleur())
listx.append (x3)
listy.append (y3)
listr.append (r3)
trouvé= True
if trouvé == True:
l.configure(text="Bravo ")
f= Tk()
c= Canvas(width =1800,height =500,bg="#b200ff")
listy=[]
listx=[]
listr=[]
for i in range(puissance(9,42)):
x=randint (0,1999)
y=randint (0,999)
r=c.create_oval(x,y,x+20,y+20,fill=tiragecouleur())
listx.append (x)
listy.append (y)
listr.append (r)
c.bind("<Button-1>", reactionclick)
c.pack()
l = Label(text="Clique !")
l.pack()
f.mainloop ()

446
Ballon/ballon(chelou(tu vas pas commprendre Mathis -toi du passé)).py

@ -0,0 +1,446 @@
from tkinter import *
from time import sleep
from random import randint
from threading import Thread
x=randint (0,1999)
y=randint (0,999)
vitesse=1
class Carrétélé(Thread) :
def __init__ (self,unx,uny,uncote,uncanvas):
Thread.__init__(self)
self.x=unx
self.y=uny
self.c=uncanvas
self.cote=uncote
self.x2=self.x+self.cote/2
self.y2=self.y+self.cote/2
self.arc =1
self.r=self.c.create_rectangle(self.x,self .y,self.x+self.cote,self .y+self.cote,fill=("#ff0000"))
self.bouge = False
self.o=self.c.create_oval(self.x2-self.arc,self.y2-self.arc,self.x2+self.arc,self.y2+self.arc,fill="#ff0000")
def run (self):
direction= 1
vitesse=1
self.bouge=True
while self.bouge==True:
if direction==1:
self.x=self.x+vitesse
sleep(0.01)
self.c.coords(self.r,self.x,self.y,self.x+self.cote,self.y+self.cote)
else:
self.x=self.x-vitesse
sleep(0.01)
self.c.coords(self.r,self.x,self.y,self.x+self.cote,self.y+self.cote)
sleep(0.01)
if self.x <0:
direction=1
vitesse = vitesse+1
if self.x +self.cote +vitesse >1855:
direction=2
vitesse = vitesse+1
self.x2=self.x+self.cote/2
self.y2=self.y+self.cote/2
while self.arc<self.cote*2:
self.arc=self.arc+1
sleep(0.001)
self.c.coords(self.o,self.x2-self.arc,self.y2-self.arc,self.x2+self.arc,self.y2+self.arc)
self.c.delete(self.r)
self.c.delete(self.o)
#carré qui bouge
def movecarrétélé(event):
Carrét.start()
def carréstop(event):
if Carrét.x <event.x<Carrét.x +cote and Carrét.y <event.y <Carrét.y+cote:
Carrét.bouge=False
print("gg")
class Ia(Thread) :
def __init__ (self,unx,uny,uncote,uncanvas):
Thread.__init__(self)
self .x=unx
self .y=uny
self .c=uncanvas
self .cote=uncote
self .r=self.c.create_rectangle(self.x,self .y,self.x+self.cote,self .y+self.cote,fill=("#ff0000"))
def run (self):
while self.r<1900:
Iahasard=randint(1,10)
sleep(0.01)
if Iahasard ==1:
self.x=self.x+vitesse
self.c.coords(self.r,self.x,self.y,self.x+self.cote,self.y+self.cote)
if Iahasard==2:
self.x=self.x-vitesse
self.c.coords(self.r,self.x,self.y,self.x+self.cote,self.y+self.cote)
if Iahasard==3:
self.y=self.y-vitesse
self.c.coords(self.r,self.x,self.y,self.x+self.cote,self.y+self.cote)
if Iahasard==4:
self.y=self.y+vitesse
self.c.coords(self.r,self.x,self.y,self.x+self.cote,self.y+self.cote)
if Iahasard==5:
self.y=self.y+vitesse
self.x=self.x+vitesse
self.c.coords(self.r,self.x,self.y,self.x+self.cote,self.y+self.cote)
if Iahasard==6:
self.y=self.y+vitesse
self.x=self.x-vitesse
self.c.coords(self.r,self.x,self.y,self.x+self.cote,self.y+self.cote)
if Iahasard==7:
self.y=self.y-vitesse
self.x=self.x+vitesse
self.c.coords(self.r,self.x,self.y,self.x+self.cote,self.y+self.cote)
if Iahasard==8:
self.y=self.y-vitesse
self.x=self.x-vitesse
self.c.coords(self.r,self.x,self.y,self.x+self.cote,self.y+self.cote)
if Iahasard ==9:
if self.cote-10>0:
self.cote=self.cote-vitesse
self.c.coords(self.r,self.x,self.y,self.x+self.cote,self.y+self.cote)
if Iahasard ==10:
self.cote=self.cote+vitesse
self.c.coords(self.r,self.x,self.y,self.x+self.cote,self.y+self.cote)
self.c.delete(self.r)
def IAactivation(event):
x = randint(0,1999)
y= randint(0,999)
Iaobjet = Ia(x,y,200,c)
Iaobjet.start()
class vide(Thread):
def __init__ (self,unx,uny,uncanvas):
Thread.__init__(self)
self.x=unx
self.y=uny
self.c=uncanvas
self.r=1
self.o=self.c.create_oval(self.x-self.r,self.y-self.r,self.x+self.r,self.y+self.r,fill="#000000")
def run(self):
while self.r<2000:
self.r=self.r+1
sleep(0.1)
self.c.coords(self.o,self.x-self.r,self.y-self.r,
self.x+self.r,self.y+self.r)
self.c.delete(self.o)
def void(event):
x = randint(0,1999)
y = randint(0,999)
trounoir=vide(x,y,c)
trounoir.start()
class Explosion(Thread):
def __init__ (self,unx,uny,uncanvas):
Thread.__init__(self)
self.x=unx
self.y=uny
self.c=uncanvas
self.r=1
self.o=self.c.create_oval(self.x-self.r,self.y-self.r,self.x+self.r,self.y+self.r,fill="#ffffff")
def run(self):
while self.r<100:
hexa=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"]
couleurhexa="#"
for i in range(6):
n=randint(0,15)
couleurhexa=couleurhexa+hexa[n]
self.r=self.r+1
sleep(0.01)
self.c.coords(self.o,self.x-self.r,self.y-self.r,
self.x+self.r,self.y+self.r)
self.c.itemconfigure(self.o, fill=couleurhexa)
self.c.delete(self.o)
#explosion
def poum(event):
x = randint(0,1999)
y= randint(0,999)
x2 = randint(0,1999)
y2= randint(0,999)
x3 = randint(0,1999)
y3= randint(0,999)
neweexplosion=Explosion(x3,y3,c)
newexplosion=Explosion(x,y,c)
neewexplosion=Explosion(x2,y2,c)
newexplosion.start()
neewexplosion.start()
neweexplosion.start()
class Carré :
def __init__ (self,unx,uny,uncote,uncanvas):
self .x=unx
self .y=uny
self .cote=uncote
self .canvas=uncanvas
self .r=self.canvas.create_rectangle(self.x,
self .y,
self.x+self.cote,
self .y+self.cote,
fill=tiragecouleur())
def deplace(self,unnewx,unnewy):
self .x=unnewx
self .y=unnewy
self.canvas.coords(self.r,
self.x,
self.y,
self.x+self.cote,
self.y+self.cote)
def color(self,color):
self.canvas.itemconfigure(self.r, fill=color)
def droit(self,droit):
self.x=self.x+droit
self.canvas.coords(self.r,
self.x,
self.y,
self.x+self.cote,
self.y+self.cote)
def gauch(self,droit):
self.x=self.x-droit
self.canvas.coords(self.r,
self.x,
self.y,
self.x+self.cote,
self.y+self.cote)
def haut(self,haut):
self.y=self.y-haut
self.canvas.coords(self.r,
self.x,
self.y,
self.x+self.cote,
self.y+self.cote)
def diagonaldroiteU(self,digdroiteU):
self.y=self.y-digdroiteU
self.x=self.x+digdroiteU
self.canvas.coords(self.r,
self.x,
self.y,
self.x+self.cote,
self.y+self.cote)
def diagonalgaucheU(self,diggaucheU):
self.y=self.y-diggaucheU
self.x=self.x-diggaucheU
self.canvas.coords(self.r,
self.x,
self.y,
self.x+self.cote,
self.y+self.cote)
def diagonalgaucheD(self,diggaucheD):
self.y=self.y+diggaucheD
self.x=self.x-diggaucheD
self.canvas.coords(self.r,
self.x,
self.y,
self.x+self.cote,
self.y+self.cote)
def diagonaldroiteD(self,digdroiteD):
self.y=self.y+digdroiteD
self.x=self.x+digdroiteD
self.canvas.coords(self.r,
self.x,
self.y,
self.x+self.cote,
self.y+self.cote)
def bas(self,haut):
self.y=self.y+haut
self.canvas.coords(self.r,
self.x,
self.y,
self.x+self.cote,
self.y+self.cote)
def agrandir(self,grandi):
self.cote=self.cote+grandi
self.canvas.coords(self.r,
self.x,
self.y,
self.x+self.cote,
self.y+self.cote)
def rétrécit(self,grandi):
if self.cote-grandi>0:
self.cote=self.cote-grandi
self.canvas.coords(self.r,
self.x,
self.y,
self.x+self.cote,
self.y+self.cote)
#flèche
def Down(event):
for i in range (0,len(listc)):
listc[i].bas(5)
def Up (event):
for i in range (0,len(listc)):
listc[i].haut(5)
def Right(event):
for i in range (0,len(listc)):
listc[i].droit(5)
def left(event):
for i in range (0,len(listc)):
listc[i].gauch(5)
#Diagonale
def diagUpdroite(event):
for i in range (0,len(listc)):
listc[i].diagonaldroiteU(5)
def diagUpgauche(event):
for i in range (0,len(listc)):
listc[i].diagonalgaucheU(5)
def diagDdroite(event):
for i in range (0,len(listc)):
listc[i].diagonaldroiteD(5)
def diagDgauche(event):
for i in range (0,len(listc)):
listc[i].diagonalgaucheD(5)
#spécial
def Big (event):
for i in range (0,len(listc)):
listc[i].agrandir(5)
def little (event):
for i in range (0,len(listc)):
listc[i].rétrécit(5)
def changecolor():
hexa=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"]
couleurhexa="#"
for i in range(6):
n=randint(0,15)
couleurhexa=couleurhexa+hexa[n]
for i in range (0,len(listc)):
listc[i].color(couleurhexa)
def ReactionBouton():
xhasard=randint(0,1999)
yhasard=randint(0,999)
for i in range (0,len(listc)):
listc[i].deplace(xhasard,yhasard)
def tiragecouleur():
hexa=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"]
couleurhexa="#"
for i in range(6):
n=randint(0,15)
couleurhexa=couleurhexa+hexa[n]
return couleurhexa
def newcarre(event):
xhasard=randint(0,1999)
yhasard=randint(0,999)
chasard=randint(0,666)
carré =Carré(xhasard,yhasard,chasard,c)
listc.append (carré)
def newcarreprécis(event):
chasard=randint(0,400)
carré =Carré (event.x-chasard/2,event.y-chasard/2,chasard,c)
listc.append (carré)
cgros=0
def grossir(event):
global cgros
cgros=cgros +1
carré=Carré (event.x-cgros/2,event.y-cgros/2,cgros,c)
listc.append (carré)
def rétécire(event):
global cgros
if cgros-1>0:
cgros=cgros -1
carré=Carré (event.x-cgros/2,event.y-cgros/2,cgros,c)
listc.append (carré)
#Ia
f= Tk()
c= Canvas(width =1900,height =900,bg="yellow")
c.pack()
moncarre=Carré( 500,600,100,c)
listc=[]
listc.append (moncarre)
p=0
x = randint(0,1899)
y= randint(0,999)
cote=randint(0,999)
Carrét = Carrétélé(x,y,cote,c)
listt=[]
listt.append (Carré)
#Ia
c.bind_all('<i>',IAactivation)
c.bind_all('<m>',movecarrétélé)
#souris
c.bind_all('<Button-1>', carréstop)
c.bind_all('<Button-2>', newcarre)
c.bind_all('<Button-3>', newcarreprécis)
c.bind_all('<Button-4>', grossir)
c.bind_all('<Button-5>', rétécire)
#clavier
c.bind_all('<space>', grossir)
c.bind_all('<t>', Big)
c.bind_all('<g>', little)
c.bind_all('<e>',poum)
c.bind_all('<v>',void)
#chiffre
c.bind_all('<KP_5>', Down)
c.bind_all('<KP_2>', Down)
c.bind_all('<KP_8>', Up)
c.bind_all('<KP_4>', left)
c.bind_all('<KP_6>', Right)
c.bind_all('<KP_9>', diagUpdroite)
c.bind_all('<KP_7>', diagUpgauche)
c.bind_all('<KP_3>', diagDdroite)
c.bind_all('<KP_1>', diagDgauche)
#flèche
c.bind_all('<Up>', Up)
c.bind_all('<Down>', Down)
c.bind_all('<Left>', left)
c.bind_all('<Right>', Right)
#Bouton
couleur =Button(text="couleur",command=changecolor)
couleur.pack()
b =Button(text="bouge",command=ReactionBouton)
b.pack()
f.mainloop()

89
Ballon/ballon_et_carré_télé.py

@ -0,0 +1,89 @@
from tkinter import *
from math import sqrt
from math import inf
from random import randint
x=randint (0,1999)
y=randint (0,999)
class Carré :
def __init__ (self,unx,uny,uncote,uncanvas):
self .x=unx
self .y=uny
self .cote=uncote
self .canvas=uncanvas
self .r=self.canvas.create_rectangle(self.x,
self .y,
self.x+self.cote,
self .y+self.cote,
fill=tiragecouleur())
def deplace(self,unnewx,unnewy):
self .x=unnewx
self .y=unnewy
self.canvas.coords(self.r,
self.x,
self.y,
self.x+self.cote,
self.y+self.cote)
def color(self,color):
self.canvas.itemconfigure(self.r, fill=color)
def droit(self,droit):
print("e")
self.x=self.x+droit
self.canvas.coords(self.r,
self.x,
self.y,
self.x+self.cote,
self.y+self.cote)
def gauch(self,droit):
print("e")
self.x=self.x-droit
self.canvas.coords(self.r,
self.x,
self.y,
self.x+self.cote,
self.y+self.cote)
def droite(event):
print("d")
moncarre.droit(5)
def left(event):
print("g")
moncarre.gauch(5)
def changecolor():
print("v")
hexa=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"]
couleurhexa="#"
for i in range(6):
n=randint(0,15)
couleurhexa=couleurhexa+hexa[n]
moncarre.color(couleurhexa)
def ReactionBouton():
print("g")
xhasard=randint(0,1900)
yhasard=randint(0,900)
moncarre.deplace(xhasard,yhasard)
def tiragecouleur():
hexa=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"]
couleurhexa="#"
for i in range(6):
n=randint(0,15)
couleurhexa=couleurhexa+hexa[n]
return couleurhexa
f= Tk()
c= Canvas(width =1850,height =850,bg="#b200ff")
c.pack()
moncarre=Carré( 505,600,100,c)
c.bind_all('<Left>', left)
c.bind_all('<Right>', droite)
couleur =Button(text="couleur",command=changecolor)
couleur.pack()
b =Button(text="bouge",command=ReactionBouton)
b.pack()

126
Ballon/ballon_tele.py

@ -0,0 +1,126 @@
from tkinter import *
from time import sleep
from random import randint
from threading import Thread
class Carretele(Thread):
def __init__ (self,unx,uny,uncote,uncanvas):
Thread.__init__(self)
self.x=unx
self.y=uny
self.c=uncanvas
self.cote=uncote
self.x2=self.x+self.cote/2
self.y2=self.y+self.cote/2
self.arc =1
self.r=self.c.create_rectangle(self.x,self .y,self.x+self.cote,self .y+self.cote,fill=("#ff0000"))
self.bouge = False
self.o=self.c.create_oval(self.x2-self.arc,self.y2-self.arc,self.x2+self.arc,self.y2+self.arc,fill="#ff0000")
def run (self):
direction= randint(1,4)
vitesse=1
self.bouge=True
while self.bouge==True:
if direction==1:
print("1")
self.x,self.y=self.x+vitesse,self.y+vitesse
sleep(0.01)
self.c.coords(self.r,self.x,self.y,self.x+self.cote,self.y+self.cote)
if self.x+self.cote+vitesse>=1900:
print("1,2")
direction=2
vitesse=vitesse+1
if self.y+self.cote+vitesse>=900:
print("1,4")
direction=4
vitesse=vitesse+vitesse
if self.y+self.cote+vitesse>=900 and self.x+self.cote+vitesse>=1900:
direction=3
vitesse=vitesse+1
elif direction==2:
print("2")
self.x,self.y=self.x-vitesse,self.y+vitesse
sleep(0.01)
self.c.coords(self.r,self.x,self.y,self.x+self.cote,self.y+self.cote)
if self.x-vitesse<=0:
print("2,1")
direction=1
vitesse=vitesse+1
if self.y+self.cote+vitesse>900:
print("2,3")
direction=3
vitesse=vitesse+1
if self.x-vitesse<=0 and self.y+self.cote+vitesse>900:
direction=4
vitesse=vitesse+1
elif direction ==3:
print("3")
self.x,self.y=self.x-vitesse,self.y-vitesse
sleep(0.01)
self.c.coords(self.r,self.x,self.y,self.x+self.cote,self.y+self.cote)
if self.x-vitesse<0:
print("3,4")
direction=4
vitesse=vitesse+1
if self.y-vitesse<0:
print("3,2")
direction=2
vitesse=vitesse+1
if self.x-vitesse<0 and self.y-vitesse<0:
direction=1
vitesse=vitesse+1
elif direction==4:
print("4")
self.x,self.y=self.x+vitesse,self.y-vitesse
sleep(0.01)
self.c.coords(self.r,self.x,self.y,self.x+self.cote,self.y+self.cote)
if self.x+self.cote+vitesse>1900:
print("4,3")
direction=3
vitesse=vitesse+1
if self.y-vitesse<0:
print("4,1")
direction=1
vitesse=vitesse+1
if self.x+self.cote+vitesse>1900 and self.y-vitesse<0:
direction=2
vitesse=vitesse+1
sleep(0.01)
self.x2=self.x+self.cote/2
self.y2=self.y+self.cote/2
while self.arc<self.cote*2:
self.arc=self.arc+1
sleep(0.001)
self.c.coords(self.o,self.x2-self.arc,self.y2-self.arc,self.x2+self.arc,self.y2+self.arc)
self.c.delete(self.r)
self.c.delete(self.o)
#carré qui bouge
def movecarrétélé(event):
Carrét.start()
def carréstop(event):
Carrét.bouge=False
if Carrét.x <event.x<Carrét.x +cote and Carrét.y <event.y <Carrét.y+cote:
Carrét.bouge=False
print("gg")
f= Tk()
c= Canvas(width =1900,height =900,bg="yellow")
c.pack()
p=0
x = randint(0,1899)
y= randint(0,999)
cote=randint(0,999)
Carrét = Carretele(x,y,cote,c)
c.bind_all('<m>',movecarrétélé)
c.bind_all('<Button-1>', carréstop)
f.mainloop()

48
mot_de_passe.py

@ -1,12 +1,46 @@
#chiffre majuscule caractère symbole vérifi isdigit vérifie nombre
from tkinter import *
from random import randint
def gen_password():
lst_c_sp=["&","à","ç","_","-","è","é","","*","§","@","µ","^","¨","$","£","=",")"]
lst_let=[]
for let in range(97,97+26):
42
lst_let.append(chr(let))
lst_numb=[]
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()
for nombre in range(0,10):
lst_numb.append(str(nombre))
password=""
if nb_c_sp_mp+nb_maj_mp + nb_chif_mp<=nb_car_mp:
while nb_chif_mp!=0 and nb_c_sp_mp!=0 and nb_chif_mp !=0 and nb_car_mp!=0:
car_aj=randint(0,3)
if car_aj==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
elif car_aj==1:
password=password+lst_let[randint(0,len(lst_let)-1)].upper()
nb_maj_mp=nb_maj_mp-1
nb_car_mp=nb_car_mp-1
elif car_aj==2:
password=password+lst_numb[randint(0,len(lst_numb)-1)]
nb_chif_mp=nb_chif_mp-1
nb_car_mp=nb_car_mp-1
else:
password=password+lst_let[randint(0,len(lst_let)-1)]
nb_car_mp=nb_car_mp-1
if (nb_chif_mp!=0 and nb_c_sp_mp!=0 and nb_chif_mp !=0 )or nb_car_mp!=0:
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()
password=""
print(password)
fenetre=Tk()
fenetre.grid()
###########Nombre de majuscule##############
@ -20,21 +54,21 @@ bouton_nb_maj.grid(row=2,column=1)
lab_nb_c_sp=Label(text="Nombre de caractère spéciaux")
lab_nb_c_sp.grid(row=1,column=2)
nb_c_sp=IntVar()
buton_nb_c_sp=Entry(textvariable=nb_maj,bd=5)
buton_nb_c_sp=Entry(textvariable=nb_c_sp,bd=5)
buton_nb_c_sp.grid(row=2,column=2)
##############Nombre de chiffre#############
lab_nb_chif=Label(text="Nombre de chiffre")
lab_nb_chif.grid(row=1,column=3)
nb_chif=IntVar()
buton_nb_chif=Entry(textvariable=nb_maj,bd=5)
buton_nb_chif=Entry(textvariable=nb_chif,bd=5)
buton_nb_chif.grid(row=2,column=3)
#############Nombre de caractère###########
lab_nb_car=Label(text="Nombre de chiffre")
lab_nb_car=Label(text="Nombre de caractère")
lab_nb_car.grid(row=1,column=4)
nb_car=IntVar()
buton_nb_car=Entry(textvariable=nb_maj,bd=5)
buton_nb_car=Entry(textvariable=nb_car,bd=5)
buton_nb_car.grid(row=2,column=4)
###################################
buton_mot_de_passe=Button(text="Creer mot de passe",command=gen_password)

Loading…
Cancel
Save