Synchronized Timer

This commit is contained in:
Alexander Nigl 2025-04-23 12:03:57 +02:00
parent a52e4c23f3
commit 7120e58e6b
2 changed files with 9 additions and 5 deletions

View File

@ -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=[

View File

@ -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()