diff --git a/setup.py b/setup.py index 040e9f2..2a45792 100644 --- a/setup.py +++ b/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=[ diff --git a/timer.py b/timer.py index 459ffd3..721b90a 100755 --- a/timer.py +++ b/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("", resize) root.bind("", 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()