Désolé je pensais l'avoir envoyée au créateur mes tu poura peut-être m'aider je te donne le code.
Je ne c'est pas comment il marche(sur python).
# -*- coding: cp1252 -*-
#Progress Bars
#Ecrit et développé par Amaury
from Tkinter import *
import time
class ProgressBar(Canvas):
def __init__(self,parent,largeur,hauteur,color):
global root,valeur,larg,haut,coul,txt,old,rainbow
root=parent
larg=largeur
coul=color
haut=hauteur
rainbow=False
Canvas.__init__(self)
self.configure(height=hauteur,width=largeur+40)
self.create_rectangle(0,0,largeur,hauteur,fill="Tan",outline="AntiqueWhite")
old=self.create_rectangle(3,3,3,18,fill=color,outline=color)
txt=self.create_text(largeur+20,hauteur/2,text="0 %")
valeur=0
def SetValue(self,consigne):
global root,valeur,larg,color,txt,old,rainbow,haut
while (int(valeur*100+.5)!=int(consigne*100+.5)):
if (valeur<consigne):
valeur=valeur+(float(consigne-valeur)/50)
float (valeur)
self.delete(old)
self.delete(txt)
txt=self.create_text(larg+20,haut/2,text=str(int(valeur))+" %")
longueur=(valeur/100)*larg
if (rainbow==False):
couleur=coul
else:
if (valeur<51):
col=5.11*valeur
if len(hex(int(col))[2:])==2:
code=str(hex(int(col))[2:])+"ff00"
elif len(hex(int(col))[2:])==1:
code="0"+str(hex(int(col))[2:])+"ff00"
elif len(hex(int(col))[2:])==1 and int(valeur)==0:
code="00ff00"
else:
code="ffff00"
elif (valeur>50):
col=255-5.11*(valeur-50)
if len(hex(int(col))[2:])==2:
code="ff"+str(hex(int(col))[2:])+"00"
elif len(hex(int(col))[2:])==1:
code="ff0"+str(hex(int(col))[2:])+"00"
else:
code="ff0000"
couleur="#"+code
old=self.create_rectangle(2,2,longueur,haut-2,fill=couleur,outline=couleur)
root.update()
time.sleep(0.002) #Définie l'inertie de l'aiguille (Timer)
elif(valeur>consigne):
valeur=valeur+(float(consigne-valeur)/50)
float (valeur)
self.delete(old)
self.delete(txt)
txt=self.create_text(larg+20,haut/2,text=str(int(valeur))+" %")
longueur=(valeur/100)*larg
if (rainbow==False):
couleur=coul
else:
if (valeur<51):
col=5.11*valeur
if len(hex(int(col))[2:])==2:
code=str(hex(int(col))[2:])+"ff00"
elif len(hex(int(col))[2:])==1:
code="0"+str(hex(int(col))[2:])+"ff00"
elif len(hex(int(col))[2:])==1 and int(valeur)==0:
code="00ff00"
else:
code="ffff00"
elif (valeur>50):
col=255-5.11*(valeur-50)
if len(hex(int(col))[2:])==2:
code="ff"+str(hex(int(col))[2:])+"00"
elif len(hex(int(col))[2:])==1:
code="ff0"+str(hex(int(col))[2:])+"00"
else:
code="ff0000"
couleur="#"+code
old=self.create_rectangle(2,2,longueur,haut-2,fill=couleur,outline=couleur)
root.update()
time.sleep(0.002) #Définie l'inertie de l'aiguille (Timer)
else:
float (valeur)
self.delete(old)
self.delete(txt)
txt=self.create_text(larg+20,haut/2,text=str(int(valeur))+" %")
longueur=(valeur/100)*larg
if (rainbow==False):
couleur=coul
else:
if (valeur<51):
col=5.11*valeur
if len(hex(int(col))[2:])==2:
code=str(hex(int(col))[2:])+"ff00"
elif len(hex(int(col))[2:])==1:
code="0"+str(hex(int(col))[2:])+"ff00"
elif len(hex(int(col))[2:])==1 and int(valeur)==0:
code="00ff00"
else:
code="ffff00"
elif (valeur>50):
col=255-5.11*(valeur-50)
if len(hex(int(col))[2:])==2:
code="ff"+str(hex(int(col))[2:])+"00"
elif len(hex(int(col))[2:])==1:
code="ff0"+str(hex(int(col))[2:])+"00"
else:
code="ff0000"
couleur="#"+code
txt=self.create_text(larg+20,haut/2,text=str(int(valeur))+" %")
old=self.create_rectangle(2,2,longueur,haut-2,fill=couleur,outline=couleur)
root.update()
time.sleep(0.002) #Définie l'inertie de l'aiguille (Timer)
def OnRainbow(self):
global rainbow
rainbow=True
def SetColor(self,couleur):
global rainbow,color
rainbow=False
color=couleur
def SetBackgroundColor(couleur):
global haut,larg
self.create_rectangle(0,0,larg,haut,fill=couleur,outline=couleur)