Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Importer les modules utilisé
- import time
- from multiprocessing import Process, Value
- import keyboard
- t = {"s": 0, "m": 0, "h": 0}
- def main(a):
- global t
- while a.Value == 1:
- t["s"] += 1
- if t["s"] >= 60:
- t["s"] = 0
- t["m"] += 1
- if t["m"] >= 60:
- t["m"] = 0
- t["h"] += 1
- print(str(t["h"]) + " : " + str(t["m"]) + " : " + str(t["s"]))
- time.sleep(1)
- def key(a):
- while a.Value == 1:
- if keyboard.is_pressed("z"):
- a = Value("i", 2)
- if __name__ == '__main__':
- a = Value("i", 1)
- p1 = Process(target=main, args=a)
- p2 = Process(target=key, args=a)
- p1.start()
- p2.start()
- p1.join()
- p2.join()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement