Skip to content

Commit 8f0f3f6

Browse files
Merge pull request #2719 from avinashkranjan/deepsource-transform-27a195c1
format code with autopep8
2 parents 960d4dd + fd03cae commit 8f0f3f6

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

Notification App/notification.py

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from datetime import datetime, timedelta
66
import winsound
77

8+
89
class NotificationApp(tk.Tk):
910
def __init__(self):
1011
super().__init__()
@@ -13,8 +14,10 @@ def __init__(self):
1314
self.configure(bg="black")
1415

1516
style = ttk.Style(self)
16-
style.configure("TLabel", foreground="white", background="black", font=("Helvetica", 12))
17-
style.configure("TButton", foreground="black", background="white", font=("Helvetica", 12))
17+
style.configure("TLabel", foreground="white",
18+
background="black", font=("Helvetica", 12))
19+
style.configure("TButton", foreground="black",
20+
background="white", font=("Helvetica", 12))
1821

1922
self.label_days = ttk.Label(self, text="Days:")
2023
self.label_days.pack(pady=5)
@@ -40,16 +43,19 @@ def __init__(self):
4043
self.entry_seconds = ttk.Entry(self)
4144
self.entry_seconds.pack()
4245

43-
self.label_message = ttk.Label(self, text="Enter notification message:")
46+
self.label_message = ttk.Label(
47+
self, text="Enter notification message:")
4448
self.label_message.pack(pady=5)
4549

4650
self.entry_message = ttk.Entry(self)
4751
self.entry_message.pack()
4852

49-
self.button_set = ttk.Button(self, text="Set Notification", command=self.schedule_notification)
53+
self.button_set = ttk.Button(
54+
self, text="Set Notification", command=self.schedule_notification)
5055
self.button_set.pack(pady=10)
5156

52-
self.label_time_left = ttk.Label(self, text="Time left: 0 days, 0:00:00")
57+
self.label_time_left = ttk.Label(
58+
self, text="Time left: 0 days, 0:00:00")
5359
self.label_time_left.pack(pady=5)
5460

5561
def show_notification(self):
@@ -60,7 +66,8 @@ def show_notification(self):
6066
notification_window.geometry("300x150")
6167
notification_window.configure(bg="black")
6268

63-
notification_label = ttk.Label(notification_window, text=f"{message}\n\nCurrent time: {now}", font=("Helvetica", 12), foreground="white", background="black")
69+
notification_label = ttk.Label(notification_window, text=f"{message}\n\nCurrent time: {now}", font=(
70+
"Helvetica", 12), foreground="white", background="black")
6471
notification_label.pack(pady=10)
6572

6673
# Play notification sound
@@ -77,13 +84,15 @@ def get_delay_time(self):
7784
seconds = int(self.entry_seconds.get())
7885

7986
if days < 0 or hours < 0 or minutes < 0 or seconds < 0:
80-
messagebox.showerror("Error", "All values must be non-negative.")
87+
messagebox.showerror(
88+
"Error", "All values must be non-negative.")
8189
return None
8290

8391
total_seconds = days * 86400 + hours * 3600 + minutes * 60 + seconds
8492
return total_seconds
8593
except ValueError:
86-
messagebox.showerror("Error", "Invalid input. Please enter numeric values.")
94+
messagebox.showerror(
95+
"Error", "Invalid input. Please enter numeric values.")
8796
return None
8897

8998
def schedule_notification(self):
@@ -92,7 +101,8 @@ def schedule_notification(self):
92101
return
93102

94103
self.button_set.config(state=tk.DISABLED)
95-
notification_thread = Thread(target=self._wait_and_notify, args=(delay,))
104+
notification_thread = Thread(
105+
target=self._wait_and_notify, args=(delay,))
96106
notification_thread.start()
97107

98108
def _wait_and_notify(self, delay):
@@ -108,6 +118,7 @@ def _wait_and_notify(self, delay):
108118
self.show_notification()
109119
self.button_set.config(state=tk.NORMAL)
110120

121+
111122
if __name__ == "__main__":
112123
app = NotificationApp()
113124
app.mainloop()

0 commit comments

Comments
 (0)