achatVente.py 495 B

1234567891011121314151617181920212223242526
  1. from threading import Thread
  2. from valeurs import *
  3. class AchatVente(Thread):
  4. def __init__(self, valeur,verrou):
  5. Thread.__init__(self)
  6. def run(self):
  7. i=0
  8. gain =0.0
  9. while 1:
  10. #~ with verrou:
  11. if valeur[i].getAAnule == 1:
  12. valeur[i].Anulation()
  13. if valeur[i].getAVendre == 1:
  14. gain=gain+valeur[i].Vente()
  15. if getMise()==0:
  16. valeur[i].Achat(25)
  17. print ("Gain : "+ str(gain))
  18. time.sleep(0.4)
  19. i=i+1
  20. if i<39:
  21. i=0