from tkinter import *
import datetime
class learn():
def __init__(self, root):
self.root=root
self.root.title("Hancie e-Learning Studio")
self.root.geometry("500x400")
currentTime = datetime.datetime.now()
if currentTime.hour < 12:
text = "Good Morning"
elif 12 <= currentTime.hour < 18:
text = "Good Afternoon"
elif currentTime.hour >= 20 and currentTime.hour <= 23:
text = "Good Night"
else:
text = "Good Evening"
greetlabel = Label(self.root,text="{}, Hancie Phago".format(text))
greetlabel.place(x=10, y=20)
if __name__=='__main__':
root=Tk()
learn(root)
root.mainloop()
Output