python tkinter display time in a windows -


i starting gui in python tkinter.and want display current time hh:mm:ss in center of windows(with big digit if possible).this app code: basic full screen windows background picture.

import tkinter tk tkinter import tk, frame, both import tkinter pil import image, imagetk root = tk.tk() root.attributes('-fullscreen', 1) im = image.open('spring.png') tkimage = imagetk.photoimage(im) myvar=tkinter.label(root,image = tkimage) myvar.place(x=0, y=0, relwidth=1, relheight=1) root.mainloop() 

edit: by current time mean keep updating time clock

add compound parameter myvar object value tkinter.center , textparameter time string. create time string add

import time time_string = time.strftime('%h:%m:%s') 

now myvar like

myvar=tkinter.label(root,image = tkimage, text = time_string, compound = tkinter.center)

for further reference see: python time: https://docs.python.org/2/library/time.html#time.strftime

python tkinter label : http://effbot.org/tkinterbook/label.htm


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -