-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathcode.py
More file actions
86 lines (70 loc) · 2.06 KB
/
Copy pathcode.py
File metadata and controls
86 lines (70 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import tkinter as tk
from tkinter import messagebox
def create_plan():
name = entry_name.get()
subject = entry_subject.get()
time_text = entry_time.get()
if not name or not subject or not time_text:
messagebox.showerror("Error", "Please fill in all fields.")
return
try:
time = int(time_text)
except ValueError:
messagebox.showerror("Error", "Time must be a number.")
return
plan = f"Hello {name}\n\nSTUDY PLAN\n\n"
if time < 30:
plan += (
"Short study session:\n"
f"- 20 minutes: revise {subject}\n"
"- 10 minutes: summary and rest\n"
)
elif time <= 60:
plan += (
"Medium study session:\n"
f"- 30 minutes: study {subject}\n"
"- 10 minutes: break\n"
"- 20 minutes: exercises\n"
)
else:
plan += (
"Long study session:\n"
f"- 40 minutes: study {subject}\n"
"- 10 minutes: break\n"
"- 30 minutes: practice\n"
"- 10 minutes: review mistakes\n"
)
plan += (
"\nMotivation:\n"
"- Stay focused.\n"
"- Every minute matters.\n"
"- Progress is better than perfection.\n"
"- You are capable of success.\n"
)
result_label.config(text=plan)
# Window setup
window = tk.Tk()
window.title("Study Buddy")
window.geometry("400x500")
# Title
title = tk.Label(window, text="STUDY BUDDY", font=("Arial", 16, "bold"))
title.pack(pady=10)
# Name
tk.Label(window, text="Your name:").pack()
entry_name = tk.Entry(window)
entry_name.pack()
# Subject
tk.Label(window, text="Subject to study:").pack()
entry_subject = tk.Entry(window)
entry_subject.pack()
# Time
tk.Label(window, text="Time available (minutes):").pack()
entry_time = tk.Entry(window)
entry_time.pack()
# Button
tk.Button(window, text="Create study plan", command=create_plan).pack(pady=10)
# Result
result_label = tk.Label(window, text="", justify="left", wraplength=350)
result_label.pack(pady=10)
# Run window
window.mainloop()