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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
| # -*- coding: cp1252 -*-
from Tkinter import*
from random import*
from time import*
def conversionimage(fich1):
for i in range(0,4):
fich1.readline()
text=fich1.readline()
while text !="":
t=[]
for i in range (0,410):
text=fich1.readline()
t.append(text)
afficheimage()
def afficheimage():
zone_dessin.create_rectangle(1,1,10,10)
def conversionbase16():
t2=[]
nb=NomFichSource.get()
nume=1
nb=int(nb)
nume=nb//16
rest=nb%16
if rest==10:
rest='A'
if rest==11:
rest='B'
if rest==12:
rest='C'
if rest==13:
rest='D'
if rest==14:
rest='E'
if rest==15:
rest='F'
if rest==16:
rest='G'
t2.append(rest)
while nume!=0:
rest=nume%16
nume=nume//16
if rest==10:
rest='A'
if rest==11:
rest='B'
if rest==12:
rest='C'
if rest==13:
rest='D'
if rest==14:
rest='E'
if rest==15:
rest="F"
if rest==16:
rest='G'
t2.append(rest)
t2.reverse()
print t2
def ouvrir():
N=NomFichSource.get()
fich1=open(N,"r")
obj5.config(text='fichier ouvert')
conversionimage(fich1)
fich1.close()
fen=Tk()
fen.title("CREATOR SPN4")
fen.geometry('600x600')
zone_dessin=Canvas(fen,width=410,height=310,bg='white')
zone_dessin.pack()
obj1=Label(fen,text='NomFichSource')
obj1.pack()
NomFichSource=Entry(fen,width=30)
NomFichSource.pack()
obj3=Button(fen,text='Valider',command=ouvrir)
obj3.pack()
obj4=Label(fen,text='Info:')
obj4.pack()
obj5=Label(fen,text='aucune information')
obj5.pack()
fen.mainloop() |
Partager