vericudebuget commited on
Commit
8f158fc
1 Parent(s): ea1aa53

Upload folder using huggingface_hub

Browse files
work/calendar++/app.py ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pygame
2
+ import os
3
+ import json
4
+ import time
5
+ import random
6
+
7
+ # Initialize Pygame
8
+ pygame.init()
9
+
10
+ # Set up the window
11
+ resolution = (800, 600)
12
+ screen = pygame.display.set_mode(resolution)
13
+ pygame.display.set_caption("Calendar")
14
+
15
+ # Load the icon
16
+ icon = pygame.image.load("icon.png")
17
+ pygame.display.set_icon(icon)
18
+
19
+ # Load the background image
20
+ bg = pygame.image.load("space.jpeg")
21
+
22
+ # Set up the font
23
+ font = pygame.font.Font(None, 36)
24
+
25
+ # Get the current date and time
26
+ current_time = time.localtime()
27
+ current_date = f"{current_time.tm_mday}/{current_time.tm_mon}/{current_time.tm_year}"
28
+
29
+ # Create the text elements
30
+ welcome_text = font.render("Welcome back!", True, (255, 255, 255))
31
+ date_text = font.render(f"Today's date is: {current_date}", True, (255, 255, 255))
32
+ time_text = font.render(f"{current_time.tm_hour}:{current_time.tm_min}:{current_time.tm_sec}", True, (255, 255, 255))
33
+
34
+ # Set the positions for the text elements
35
+ welcome_pos = (10, 10)
36
+ date_pos = (10, 50)
37
+ time_pos = (10, 90)
38
+
39
+ # Load the saved events from the JSON file
40
+ try:
41
+ with open("save.json", "r") as f:
42
+ events = json.load(f)
43
+ except (FileNotFoundError, json.JSONDecodeError):
44
+ # If the file is not found or is empty, create a new empty list
45
+ events = []
46
+
47
+ # Check for events that are a week in the future
48
+ for event in events:
49
+ event_time = time.strptime(event["date"], "%d %m %y")
50
+ if abs(event_time.tm_yday - current_time.tm_yday) == 7:
51
+ print(f"You have an event in a week: {event['title']} on {event['date']}")
52
+
53
+ # Check if there are any events today
54
+ today_events = [event for event in events if event["date"] == current_date]
55
+ if today_events:
56
+ print("You have an event today!")
57
+
58
+ # Create a new event
59
+ new_event_title = input("Enter the event title: ")
60
+ new_event_date = input("Enter the event date (DD MM YY): ")
61
+ new_event_time = input("Enter the event time (HH MM SS): ")
62
+ new_event = {"title": new_event_title, "date": new_event_date, "time": new_event_time}
63
+ events.append(new_event)
64
+
65
+ # Main game loop
66
+ running = True
67
+ while running:
68
+ # Handle events
69
+ for event in pygame.event.get():
70
+ if event.type == pygame.QUIT:
71
+ running = False
72
+
73
+ # Draw the background
74
+ screen.blit(bg, (0, 0))
75
+
76
+ # Draw the text elements
77
+ screen.blit(welcome_text, welcome_pos)
78
+ screen.blit(date_text, date_pos)
79
+ screen.blit(time_text, time_pos)
80
+
81
+ # Update the display
82
+ pygame.display.flip()
83
+
84
+ # Save the events to the JSON file
85
+ with open("save.json", "w") as f:
86
+ json.dump(events, f)
87
+
88
+ # Quit Pygame
89
+ pygame.quit()
work/calendar++/icon.png ADDED
work/calendar++/save.json ADDED
@@ -0,0 +1 @@
 
 
1
+ [{"title": "ok", "date": "22 12 2024", "time": "12 12 12"}]
work/calendar++/space.jpeg ADDED