
lvl1 male rogue St=1 Dex=5 Int=17 Wi=5 Ch=0
   
Groupe : Modérateurs
Messages : 1,730
Inscrit le : 16/05/2002 23:00
Lieu : .gif
Membre no. 12

|
CODE |
from Tkinter import *
def Clear_bton():
Texte.delete(0,END)
Graph.delete(ALL)
def Code_bton():
checksum=0
for pos in range(10):
Graph.create_line(pos,0,pos,64,fill="white")
pos=10
pos=Decode(211214,pos,6)
text=Texte.get()
for x in range(len(text)):
cara=str(text[x])
ctere=-1
for y in range(94):
if cara==Jeu_B[y]:
ctere=y
break
pos=Decode(Codes_B[ctere],pos,6)
checksum=checksum+((x+1)*ctere)
checksum=checksum+104
checksum=checksum%103
print "\nChecksum= %s"%checksum
pos=Decode(Codes_B[checksum],pos,6)
print "\n",
pos=Decode(2331112,pos,7)
def Decode(suite,ps,length):
variable=0
exposant=6
chiffre=0
for boucle in range(length):
essai=str(suite)
chiffre=eval(essai[boucle])
if variable==1:
variable=0
else:
variable=1
print(chiffre),
for pixel in range(chiffre):
if variable==1:
Graph.create_line(ps,0,ps,64)
ps=ps+1
else:
Graph.create_line(ps,0,ps,64,fill="white")
ps=ps+1
return ps
Jeu_B=[" ","!",chr(34),"#","$","%","&","'","(",")","*","+",",","-",".","/","0","1","2","3","4","5","6","7","8","9",":",";","<","=",">","?","@","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[",chr(92),"]","^","_","`","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","{","|","}","~"]
Codes_B=& #91;212222,222122,222221,121223,121322,131222,122213,122312,132212,221213,221312 ,231212,112232,122132,122231,113222,123122,123221,223211,221132,221231,213212,22 3112,312131,311222,321122,321221,312212,322112,322211,212123,212321,232121,11132 3,131123,131321,112313,132113,132311,211313,231113,231311,112133,112331,132131,1 13123,113321,133121,313121,211331,231131,213113,213311,213131,311123,311321,3311 21,312113,312311,332111,314111,221411,431111,111224,111422,121124,121421,141122, 141221,112214,112412,122114,122411,142112,142211,241211,221114,413111,241112,134 111,111242,121142,121241,114212,124112,124211,411212,421112,421211,212141,214121 ,412121,111143,111341,131141,114113,114311,411311,113141,114131,311141,411131,21 1412]
root=Tk()
Code=Button(root,text="Code",command=Code_bton)
Code.grid(row=0,column=0)
Clear=Button(root,text="Clear",command=Clear_bton)
Clear.grid(row=0,column=1)
Texte=Entry(root)
Texte.grid(row=1,column=0)
Graph=Canvas()
Graph.grid(row=2,column=2)
root.mainloop()
|
( le bloc note a un word wrap bizarre au copier/coller ... )
bon, il manque encore la sauvegarde du code sous forme d'image mais je verrais ça plus tard ...
--------------------
Natural evolution insists that we are apes; artificial evolution insists that we are machines with an attitude. Kevin Kelly - Out of control
|