Advertisement
FranzVuttke

ring_the_bell.py

Nov 19th, 2023 (edited)
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | Source Code | 0 0
  1. #!/usr/bin/python
  2.  
  3. #import os
  4. import sys
  5. from time import sleep
  6.  
  7. DEF_RINGING_TIMES = 10
  8.  
  9. def belll():
  10.     # if print("\a") will fail....
  11.     # import os
  12.     # os.system('echo "\007"')
  13.  
  14.     print("\a", end="")
  15.     print(flush=True, end="")
  16.  
  17. how_much = DEF_RINGING_TIMES
  18. if len(sys.argv) > 1:
  19.     try:
  20.            how_much = int(sys.argv[1])
  21.     except ValueError:
  22.             pass
  23.  
  24. for i in range(how_much):
  25.     belll()
  26.     sleep(0.098)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement