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
| import wx
import time
class Monapp(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title, size=(300, 200))
panel = wx.Panel(self, -1)
vbox = wx.BoxSizer(wx.VERTICAL)
hbox = wx.BoxSizer(wx.HORIZONTAL)
hbox1 = wx.BoxSizer(wx.HORIZONTAL)
self.text = wx.StaticText(panel, -1, '', style=wx.ALIGN_CENTRE)
self.textcount = wx.StaticText(panel, -1, '', style=wx.ALIGN_CENTRE)
self.g1 = wx.Gauge(panel, -1, 100, size=(250, 25))
self.g1.SetValue(0)
btn1 = wx.Button(panel, wx.ID_OK)
self.Bind(wx.EVT_BUTTON, self.relations, btn1)
hbox.Add(self.g1, 1, wx.ALIGN_CENTRE)
hbox1.Add(btn1, 1, wx.ALIGN_CENTRE)
vbox.Add((0, 30), 0)
vbox.Add(self.text, 1, wx.ALIGN_CENTRE)
vbox.Add(self.textcount, 1, wx.ALIGN_CENTRE)
vbox.Add(hbox, 1, wx.ALIGN_CENTRE)
vbox.Add(hbox1, 1, wx.ALIGN_CENTRE)
panel.SetSizer(vbox)
self.Centre()
self.Show(True)
def relations(self, event):
#################################
# Comme je ne sais pas ce que fonts vos listes j'en genere une pour l'exemple
#liste=os.listdir(maissa.path1)
#liste2=glob.glob(maissa.path1)
#liste7=[]
#liste4=[]
#liste3=[]
#liste_glob=[]
#liste6=[]
#f2=open("relation.txt",'a')
liste=[i for i in xrange(1000)]
##################################
self.g1.SetRange(len(liste))
self.tps1 = time.clock()
for i in range(len(liste)):
self.g1.SetValue(i)
wx.Yield()
##################################
# path_s=liste2[0]+'\\' + liste[i]
# if liste[i]=="KRN_ASW.H":
# f1=open(path_s,'r')
# liste_glob=relation_krn.proc3(liste_glob,f1)
# if (('_fct' in liste[i]) and (liste[i].endswith('.c'))or ('_FCT' in liste[i])) and (liste[i].endswith('.C')):
# liste3=tab5_fct.proc(liste3,path_s)
# X=path_s.endswith("_SCH.C") or path_s.endswith("_SCH.c")or path_s.endswith("_sch.c")or path_s.endswith("_sch.C")
# if X == True:
# liste4=tab5_sch.proc2(liste4,path_s)
#liste5=liste3+liste4
# Meme souci avec liste5 un, donc je fais une copie de liste.
liste5 = liste
##################################
self.text.SetLabel("len de liste5 est " + str(len(liste5)))
self.text.CentreOnParent(wx.HORIZONTAL)
##################################
# Toujours pour remplacer le code
#for i in range(len(liste_glob)):
# liste = liste_glob[i]
# for j in range(len(liste5)):
# listea=liste5[j]
# if liste[-1] == listea[0]:
# a=liste+listea[1:len(listea)+1]
# liste6.append(a)
for i in range(len(liste5)):
print(i)
##################################
self.tps2 = time.clock()
self.textcount.SetLabel("le temps d'execution en seconde est " + str((self.tps2 - self.tps1)))
self.textcount.CentreOnParent(wx.HORIZONTAL)
dlg = wx.MessageDialog(self, 'Fin dexecution', 'Talmud', wx.OK|wx.ICON_INFORMATION)
dlg.ShowModal()
dlg.Destroy()
app = wx.App()
Monapp(None, -1, 'Test')
app.MainLoop() |
Partager