MCPcopy Create free account
hub / github.com/geekcomputers/Python / show_notification

Function show_notification

Pomodoro (tkinter).py:42–72  ·  view source on GitHub ↗
(message)

Source from the content-addressed store, hash-verified

40
41# ---------------------------- NOTIFICATION FUNCTION ------------------------------- #
42def show_notification(message):
43 notif = Toplevel(window)
44 notif.overrideredirect(True)
45 notif.config(bg=PINK)
46
47 msg_label = Label(
48 notif,
49 text=message,
50 font=(FONT_NAME, 12, "bold"),
51 bg=GREEN,
52 fg="white",
53 padx=10,
54 pady=5,
55 )
56 msg_label.pack()
57
58 window.update_idletasks()
59 wx = window.winfo_rootx()
60 wy = window.winfo_rooty()
61 wwidth = window.winfo_width()
62 wheight = window.winfo_height()
63
64 notif.update_idletasks()
65 nwidth = notif.winfo_width()
66 nheight = notif.winfo_height()
67
68 x = wx + (wwidth - nwidth) // 2
69 y = wy + wheight - nheight - 10
70 notif.geometry(f"+{x}+{y}")
71
72 notif.after(3000, notif.destroy)
73
74
75# ---------------------------- TIMER FUNCTIONS ------------------------------- #

Callers 1

count_downFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected