Skip to content

Instantly share code, notes, and snippets.

@daftspaniel
Last active February 13, 2021 20:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daftspaniel/e8f828e5297585e2ea37c8eae0fc5e83 to your computer and use it in GitHub Desktop.
Save daftspaniel/e8f828e5297585e2ea37c8eae0fc5e83 to your computer and use it in GitHub Desktop.
Super simple Tkinter clock. v0.1
# Super simple Tkinter clock. v0.1
# Public domain.
# 2021 Feb 13 - daftspaniel - www.casterbridge.xyz
import tkinter as tk
import time
class App():
def __init__(self):
self.root = tk.Tk()
# Customise display of time here.
self.time = tk.Label(text="",font=("Mono", 18), bg="black", fg="grey" )
self.time.pack()
self.update_time()
self.root.geometry("+20+20") # Position Window at top left of screen
self.root.mainloop()
def update_time(self):
self.time.configure(text=time.strftime("%H:%M:%S")) # Change to "%H:%M" if you don't want seconds.
self.root.after(1000, self.update_time)
app=App()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment