This repository was archived by the owner on Apr 24, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66top .title ("Dynamic Clock" ) # Updated title
77top .resizable (0 , 0 ) # Making the window non-resizable
88
9+
910# Function to determine the time of day
1011def get_time_of_day (hour ):
1112 if 5 <= hour < 12 :
@@ -15,6 +16,7 @@ def get_time_of_day(hour):
1516 else :
1617 return "Evening"
1718
19+
1820# Function to update the time display
1921def update_time ():
2022 current_time = strftime ("%H:%M:%S %p" )
@@ -25,12 +27,17 @@ def update_time():
2527 clock_time .config (text = current_time + f"\n Good { time_of_day } !" )
2628
2729 # Dynamically change the background color based on time of day
28- color = "lightblue" if time_of_day == "Morning" else "lightyellow" if time_of_day == "Afternoon" else "lightcoral"
30+ color = (
31+ "lightblue"
32+ if time_of_day == "Morning"
33+ else "lightyellow" if time_of_day == "Afternoon" else "lightcoral"
34+ )
2935 top .configure (background = color )
3036
3137 # Schedule the update_time function to be called again after 1000 milliseconds (1 second)
3238 clock_time .after (1000 , update_time )
3339
40+
3441# Creating a Label widget to display the time
3542clock_time = tkinter .Label (
3643 top ,
Original file line number Diff line number Diff line change 22import random
33from tkinter import messagebox
44
5+
56class TileMatchingGame :
67 def __init__ (self , root , rows , columns ):
78 self .root = root
@@ -125,6 +126,7 @@ def reset_game(self):
125126 self .root .destroy ()
126127 main ()
127128
129+
128130def main ():
129131 root = tk .Tk ()
130132 root .title ("Tile Matching Game" )
@@ -143,5 +145,6 @@ def main():
143145
144146 root .mainloop ()
145147
148+
146149if __name__ == "__main__" :
147150 main ()
You can’t perform that action at this time.
0 commit comments