Advertisement
alexs77

zeit.py 1

Jan 14th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.89 KB | None | 0 0
  1. import tkinter as tk
  2. import time
  3.  
  4. counter = 0
  5. lt = time.localtime()
  6. def counter_label(label_Zeit, label_Datum):
  7.   counter = 0
  8.   def count():
  9.     global counter
  10.     counter += 1
  11.     lt = time.localtime()
  12.     label_Zeit.config(text="{0:02d}:{1:02d}:{2:02d} ".format(lt[3], lt[4], lt[5]))
  13.     label_Datum.config(text="{0:02d}.{1:02d}.{2:4d}".format(lt[2], lt[1], lt[0]))
  14.     label_Zeit.after(1000, count)
  15.   count()
  16.  
  17.  
  18. root = tk.Tk()
  19. root.resizable(False, False)
  20. root.wm_attributes("-topmost", 1)
  21. root.title("")
  22. label_Zeit = tk.Label(root, fg="blue2", font=("Realpolitik", 16))
  23. label_Datum = tk.Label(root, fg="dark blue", font=("Ink Free",16, "bold"))
  24. label_Zeit.pack()
  25. label_Datum.pack()
  26. counter_label(label_Zeit, label_Datum)
  27. button = tk.Button(root, text='Stop',fg="DodgerBlue2", font=("Realpolitik Semi-Bold Semi-Ital", 16), width=25, command=root.destroy)
  28. button.pack()
  29. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement