Skip to content

Commit d329b3d

Browse files
committed
added clock on main window
1 parent 7182fbb commit d329b3d

1 file changed

Lines changed: 25 additions & 2 deletions

File tree

UI/Menu/menu.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,16 @@
1313
from tkinter import *
1414
from tkinter.ttk import *
1515

16+
from platform import *
17+
1618
from time import strftime
1719

1820
import tkinter.messagebox as mb
1921

22+
import platform
23+
24+
import datetime
25+
2026
def Home():
2127
def MoreApps():
2228
def openFileExplorerViaMoreApps():
@@ -67,7 +73,7 @@ def openCalendarAppViaMoreApps():
6773
output_iconweatherapp = Button(moreapps, text="WeatherApp", image=iconweatherapp, command=openWeatherAppViaMoreApps)
6874
output_iconweatherapp.image = iconweatherapp
6975
output_iconweatherapp.place(relx=0.60, rely=0.15, anchor=CENTER)
70-
Label(moreapps, text="Weather", font=("Arial", 10)).place(relx=0.55, rely=0.22)
76+
Label(moreapps, text="Weather", font=("Arial", 10)).place(relx=0.56, rely=0.22)
7177

7278
iconcalendarapp = PhotoImage(file="UI/Menu/icons/calendar-icon.png")
7379
output_iconcalendarapp = Button(moreapps, text="Calendar", image=iconcalendarapp, command=openCalendarAppViaMoreApps)
@@ -406,4 +412,21 @@ def shutdownmaxpyos():
406412
iconmenucircled = PhotoImage(file="UI/Menu/icons/menucircled-icon.png")
407413
output_iconmenucircled = Button(home, text="Settings",image=iconmenucircled, command=MoreApps)
408414
output_iconmenucircled.image = iconmenucircled
409-
output_iconmenucircled.place(relx=0.50, rely=0.90, anchor=CENTER)
415+
output_iconmenucircled.place(relx=0.50, rely=0.90, anchor=CENTER)
416+
417+
current_day = datetime.date.today().day
418+
current_month = datetime.date.today().month
419+
current_year = datetime.date.today().year
420+
421+
def time():
422+
actual_time=strftime('%H:%M')
423+
current_time.config(text=actual_time)
424+
current_time.after(1000, time)
425+
426+
current_time = Label(home, text=f"", font=("Monospace", 10))
427+
current_time.place(relx=0.92, rely=0.92)
428+
time()
429+
430+
Label(home, text=f"{current_day}/{current_month}/{current_year}", font=("Monospace", 10)).place(relx=0.90, rely=0.87)
431+
432+
home.mainloop()

0 commit comments

Comments
 (0)