Last active
February 13, 2021 20:16
-
-
Save daftspaniel/e8f828e5297585e2ea37c8eae0fc5e83 to your computer and use it in GitHub Desktop.
Super simple Tkinter clock. v0.1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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