Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- import time
- import sys
- import os
- COMMAND = "open ~/.stop.jpg"
- def clock(hour=0, minute=0):
- sec = minute*60 + hour*3600
- while sec:
- s = sec % 60
- m = int((sec / 60)) % 60
- h = int(sec / 3600)
- print('{:02}:{:02}:{:02}'.format(h, m, s))
- sys.stdout.flush()
- time.sleep(1)
- sec -= 1;
- def execute():
- os.system(COMMAND)
- def parse_time(time_str):
- return tuple([int(it) for it in time_str.split(':')])
- def main():
- hour, minute = parse_time(sys.argv[1])
- command = "open ~/hgkhi/pic/stahp.jpg"
- clock(hour, minute)
- execute()
- main()
Add Comment
Please, Sign In to add comment