I have just started using kivy and Tkinter to develop simple apps for starters. Recently, I created a digital Clock program that can be used on desktop. It works fine because it is simple with just a few lines of codes. I wanted to add one functionality which is Alarm. Can anyone please guide me on how to go about it.
It is my first time, so am not sure if I posted this question the right way or not. So below is the code I used to get my output.
import tkinter as tk
from tkinter.ttk import *
# I imported strftime to use for formatting time details of the program.
from time import strftime
import datetime
# creating tkinter window
root = tk.Tk()
root.title('Clock')
root.attributes('-topmost', True) # This line here sets our app to be the
topmost in the window screen.
# root.attributes('-topmost', False) When this line is added, the app will
no longer have that topmost privilege.
# This function will show us the calender on the program.
def datetime():
string1 = strftime('%d/%b/%Y') # This line can be joined with the other one below with \n and it will work.
lbl1.config(text=string1)
lbl1.after(1000, datetime)
lbl1 = Label(root, font=('verdana', 20, 'bold'), background='black',
foreground='#808000')
lbl1.pack(fill=tk.BOTH)
datetime()
# This function is used to display time on our label
def time():
string = strftime('%H:%M:%S %p')
lbl.config(text=string)
lbl.after(1000, time) # updating the label.
# Giving the Label some style.
lbl = Label(root, font=('verdana', 22, 'bold'), background='#050929',
foreground='silver')
# packing the Label to the center.
# of the tkinter window
lbl.pack(anchor=tk.CENTER)
time()
root.mainloop()