1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| from tkinter import *
import time
fen = Tk()
fen.geometry("1000x750")
photo = PhotoImage(file="mon_image.png")
canvas = Canvas(fen,width=1000, height=750)
canvas.create_image(0, 0, anchor=NW, image=photo)
canvas.pack()
# Création d'un widget Label
heure = StringVar()
Label(fen,textvariable=heure).pack(side=RIGHT, padx=300, pady=10)
def maj():
# on arrive ici toutes les 1000 ms
heure.set(time.strftime('%H:%M:%S'))
fen.after(1000,maj)
maj()
fen.mainloop() |
Partager