Synchronized Timer
This commit is contained in:
parent
a52e4c23f3
commit
7120e58e6b
2
setup.py
2
setup.py
@ -2,7 +2,7 @@ from setuptools import setup
|
||||
|
||||
setup(
|
||||
name="timer",
|
||||
version="0.2",
|
||||
version="0.3",
|
||||
author="Alexander Nigl",
|
||||
py_modules=["timer"],
|
||||
install_requires=[
|
||||
|
||||
12
timer.py
12
timer.py
@ -46,9 +46,7 @@ class DateTime(click.DateTime):
|
||||
return None
|
||||
|
||||
|
||||
@click.command()
|
||||
@click.argument("enddate", type=DateTime(formats=DATETIME_FORMAT))
|
||||
def main(enddate):
|
||||
def start_app(enddate):
|
||||
root = Tk()
|
||||
root.geometry("300x100+200+200")
|
||||
root.configure(background="#000")
|
||||
@ -79,7 +77,7 @@ def main(enddate):
|
||||
tlbl.config(fg="red")
|
||||
else:
|
||||
tlbl.configure(text=deltaStr(delta))
|
||||
root.after(1000, update)
|
||||
root.after(1000 - int(datetime.datetime.now().microsecond / 1000), update)
|
||||
|
||||
root.bind("<Configure>", resize)
|
||||
root.bind("<Escape>", lambda x: root.destroy())
|
||||
@ -89,5 +87,11 @@ def main(enddate):
|
||||
root.mainloop()
|
||||
|
||||
|
||||
@click.command()
|
||||
@click.argument("enddate", type=DateTime(formats=DATETIME_FORMAT))
|
||||
def main(enddate):
|
||||
start_app(enddate)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user