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( setup(
name="timer", name="timer",
version="0.2", version="0.3",
author="Alexander Nigl", author="Alexander Nigl",
py_modules=["timer"], py_modules=["timer"],
install_requires=[ install_requires=[

View File

@ -46,9 +46,7 @@ class DateTime(click.DateTime):
return None return None
@click.command() def start_app(enddate):
@click.argument("enddate", type=DateTime(formats=DATETIME_FORMAT))
def main(enddate):
root = Tk() root = Tk()
root.geometry("300x100+200+200") root.geometry("300x100+200+200")
root.configure(background="#000") root.configure(background="#000")
@ -79,7 +77,7 @@ def main(enddate):
tlbl.config(fg="red") tlbl.config(fg="red")
else: else:
tlbl.configure(text=deltaStr(delta)) 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("<Configure>", resize)
root.bind("<Escape>", lambda x: root.destroy()) root.bind("<Escape>", lambda x: root.destroy())
@ -89,5 +87,11 @@ def main(enddate):
root.mainloop() root.mainloop()
@click.command()
@click.argument("enddate", type=DateTime(formats=DATETIME_FORMAT))
def main(enddate):
start_app(enddate)
if __name__ == "__main__": if __name__ == "__main__":
main() main()