Advertisement
Guest User

Untitled

a guest
Dec 6th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. # Uhr ohne OOP, Py3
  2. # D. Hirschi 2019
  3.  
  4. from tkinter import *
  5. from time import *
  6. from threading import *
  7.  
  8. def ende():
  9. top.destroy()
  10.  
  11. def update_zeit():
  12. while(1==1):
  13. zeit = asctime()
  14. print(zeit)
  15. Label1.config(text = zeit)
  16. sleep(1)
  17.  
  18.  
  19. # Definition des GUI
  20.  
  21. top=Tk()
  22. top.geometry("300x150")
  23. top.title("Uhr ohne OOP")
  24.  
  25. Label1 = Label(top)
  26. Label1.config(font=("Courier", 24))
  27. Label1.pack()
  28.  
  29. Ende=Button(top,text="Ende", command=ende)
  30. Ende.pack(side="right")
  31.  
  32.  
  33. threads = []
  34. t1 = Thread(target=update_zeit)
  35. threads.append(t1)
  36. t1.start()
  37.  
  38.  
  39.  
  40. # Endlosschleife, die das Programm ausführt
  41.  
  42. top.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement