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
| #!/usr/bin/python
# -*- coding: cp1252 -*-
###Librairies
import wx #Permet d'accéder au wxWidgets (Interface graphique)
####
nbip = 3
class LesMenus(wx.Frame):
def __init__(self, titre):
wx.Frame.__init__(self, None, 1,title = titre, size = (800,600))
######### Insertion image
self.scrollPane = wx.ScrolledWindow(self , -1, pos = (0,0), size = (800,600))
#########
########## Fonction de division
def div(a, b):
resu = round(a/b, 1)
return resu
##########
########## Fonction de connection Pb affichage
def actualisation(nbrstot, nbrtot):
####### Actualisation compteur et pourcentage
####
self.count = self.count + nbrstot
self.counttot = self.counttot + nbrtot
self.gauge.SetValue(self.count)
self.gauge2.SetValue(self.counttot)
####
#### Actualisation Pourcentage
self.pretext22 = wx.StaticText(self.scrollPane, 1, repr(self.count) + "%", pos = (750,400), style = wx.ALIGN_RIGHT)
self.pretext32 = wx.StaticText(self.scrollPane, 1, repr(self.counttot) + "%", pos = (750,500), style = wx.ALIGN_RIGHT)
self.Update() #Update de l'affichage
if nbrstot == 0 and nbrtot == 0:
return self.count
####
#######
#########
########## Initialisation Barre de progression
self.count = 0.0 #Initialisation compteur pour barre progression sous tot
self.counttot = 0.0 #Initialisation compteur pour barre progression totale
self.pretext1 = wx.StaticText(self.scrollPane, 1, "Barre de progression", pos = (0,375), style = wx.ALIGN_CENTER)
## Bar de prog sous total
self.pretext2 = wx.StaticText(self.scrollPane, 1, "Sous total :", pos = (0,400), style = wx.ALIGN_CENTER)
self.pretext22 = wx.StaticText(self.scrollPane, 1, repr(self.count) + "%", pos = (750,400), style = wx.ALIGN_CENTER)
self.gauge = wx.Gauge(self.scrollPane, -1, pos = (0,425), size = (800,50))
##
## Bar de prog total
self.pretext3 = wx.StaticText(self.scrollPane, 1, "Total :", pos = (0,500), style = wx.ALIGN_CENTER)
self.pretext32 = wx.StaticText(self.scrollPane, 1, repr(self.counttot) + "%", pos = (750,500), style = wx.ALIGN_CENTER)
self.gauge2 = wx.Gauge(self.scrollPane, -1, pos = (0,525), size = (800,50))
self.Update() #Update de l'affichage
##########
actualisation(1.0, div(1.0, nbip)) #Actualisation barre 1, 1/nbip
class MonApp(wx.App):
def OnInit(self):
fen = LesMenus("CISCO TOOLS V1.5")
fen.Show(True)
self.SetTopWindow(fen)
return True
app = MonApp()
app.MainLoop() |
Partager