File tree Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change 4
4
from tkinter .constants import BOTTOM , FLAT , LEFT
5
5
from tkinter .font import BOLD
6
6
import threading
7
- import winsound
7
+ import os
8
8
9
- ctypes .windll .shcore .SetProcessDpiAwareness (True )
9
+ try :
10
+ import winsound
11
+ ctypes .windll .shcore .SetProcessDpiAwareness (True )
12
+ except Exception :
13
+ pass
10
14
11
15
root = Tk ()
12
16
root .config (bg = "Salmon" )
@@ -68,17 +72,24 @@ def start_timer(options, cycle_limit=5):
68
72
root .update_idletasks ()
69
73
time .sleep (1 )
70
74
temp_work -= 1
71
- winsound .Beep (323 , 250 )
72
- winsound .Beep (583 , 250 )
75
+ try :
76
+ winsound .Beep (323 , 250 )
77
+ winsound .Beep (583 , 250 )
78
+ except Exception :
79
+ os .system ('tput bel' )
80
+
73
81
while temp_break :
74
82
title_label .config (text = "You should be taking a break now." )
75
83
minutes , seconds = divmod (temp_break , 60 )
76
84
timer_label .config (text = f"{ minutes } :{ seconds } " )
77
85
root .update_idletasks ()
78
86
time .sleep (1 )
79
87
temp_break -= 1
80
- winsound .Beep (523 , 250 )
81
- winsound .Beep (783 , 250 )
88
+ try :
89
+ winsound .Beep (523 , 250 )
90
+ winsound .Beep (783 , 250 )
91
+ except Exception :
92
+ os .system ('tput bel' )
82
93
cycles += 1
83
94
84
95
reset ()
You can’t perform that action at this time.
0 commit comments