Skip to content

Instantly share code, notes, and snippets.

@ROBOMASTER-S1
Created March 8, 2023 06:52
Show Gist options
  • Save ROBOMASTER-S1/ef6416ce3076be51f22c394a8b700d26 to your computer and use it in GitHub Desktop.
Save ROBOMASTER-S1/ef6416ce3076be51f22c394a8b700d26 to your computer and use it in GitHub Desktop.
My TKINTER CLOCK Python Program Example: Created by Joseph C. Richardson
'''
My TKINTER CLOCK Python Program Example:
Created by Joseph C. Richardson, GitHub.com
'''
import tkinter as tk
import time as tm
window=tk.Tk()
window.config(bg='black')
def timernator():
current_time1=tm.strftime('%I:%M:%S:%p')
current_time2=tm.strftime('%H:%M:%S')
current_time3=tm.strftime('%A %B %d, %Y')
current_time4=tm.strftime('Day %j, Week %U')
clock_label1['text']=current_time1
clock_label2['text']=current_time2
clock_label3['text']=current_time3
clock_label4['text']=current_time4
window.after(1000,timernator)
window.title('My TKINTER CLOCK')
time=tk.Label(window,font='arial 50 bold',text='My TKINTER CLOCK',bg='black',fg='red')
clock_label1=tk.Label(window,font='arial 40',bg='black',fg='#ffff00')
clock_label2=tk.Label(window,font='arial 40',bg='black',fg='#00ff00')
clock_label3=tk.Label(window,font='arial 40',bg='black',fg='#000fff')
clock_label4=tk.Label(window,font='arial 40',bg='black',fg='#ff00ff')
clock_label1.grid(row=1,column=0)
clock_label2.grid(row=2,column=0)
clock_label3.grid(row=3,column=0)
clock_label4.grid(row=4,column=0)
time.grid(row=0,column=0)
timernator()
window.mainloop()
'''
'%I' 12-hour prefix
'%H' 24-hour prefix
'%M' Minutes prefix
'%S' Seconds prefix
'%p' AM/PM prefix
'%A' Day of week prefix
'%B' Month prefix
'%d' Date prefix
'%Y' Year prefix
'%U' Weeks per year prefix
'%j' Days per year prefix
'''
@ROBOMASTER-S1
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment