Difference between
modified post 3da3b by Anonymous on Tue 15th Jan 2019 08:58
original post 0b258 by Anonymous on Tue 15th Jan 2019 08:57
Download diff
Show
old version |
new version |
both versions
1 | 1 | import tkinter as tk | |
2 | 2 | import time | |
4 | 4 | counter = 0 | |
5 | 5 | lt = time.localtime() | |
6 | 6 | def counter_label(label_Zeit, label_Datum): | |
7 | 7 | counter = 0 | |
8 | 8 | def count(): | |
9 | 9 | global counter | |
10 | 10 | counter += 1 | |
11 | 11 | lt = time.localtime() | |
12 | 12 | label_Zeit.config(text="{0:02d}:{1:02d}:{2:02d} ".format(lt[3], lt[4], lt[5])) | |
13 | 13 | label_Datum.config(text="{0:02d}.{1:02d}.{2:4d}".format(lt[2], lt[1], lt[0])) | |
14 | + | label_Dauer.config(text="{0:d}".format(counter)) | |
14 | 15 | label_Zeit.after(1000, count) | |
15 | 16 | count() | |
17 | 18 | root = tk.Tk() | |
18 | 19 | root.resizable(False, False) | |
19 | 20 | root.wm_attributes("-topmost", 1) | |
20 | 21 | root.title("") | |
21 | 22 | label_Zeit = tk.Label(root, fg="blue2", font=("Realpolitik", 16)) | |
22 | 23 | label_Datum = tk.Label(root, fg="dark blue", font=("Ink Free",16, "bold")) | |
24 | + | label_Dauer = tk.Label(root, fg="dark blue", font=("Ink Free",16, "bold")) | |
23 | 25 | label_Zeit.pack() | |
24 | 26 | label_Datum.pack() | |
27 | + | label_Dauer.pack() | |
25 | 28 | counter_label(label_Zeit, label_Datum) | |
26 | 29 | button = tk.Button(root, text='Stop',fg="DodgerBlue2", font=("Realpolitik Semi-Bold Semi-Ital", 16), width=25, command=root.destroy) | |
27 | 30 | button.pack() | |
28 | 31 | root.mainloop() |
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.
Syntax highlighting:
To highlight particular lines, prefix each line with {%HIGHLIGHT}