File tree Expand file tree Collapse file tree 1 file changed +30
-1
lines changed
days/01-03-datetimes/my_code Expand file tree Collapse file tree 1 file changed +30
-1
lines changed Original file line number Diff line number Diff line change 4
4
#
5
5
# Pomadaro Timer
6
6
# - Playing with Datetimes...
7
+ # - or time, anyway...
7
8
#
8
9
# Brent Gawryluik
9
10
# 2018-07-09
10
11
# ------------------------------------------------------------------------
11
12
12
13
import helpers
14
+ import progressbar
15
+ import time
13
16
14
17
15
18
def main ():
16
19
helpers .print_header ('Pomadaro Timer' )
17
20
work_duration = get_duration_input ("WORK" )
18
21
rest_duration = get_duration_input ("REST" )
22
+ display_timer (work_duration , 'WORK' )
23
+ display_timer (rest_duration , 'REST' )
24
+ print ()
25
+ print ('Exiting the Pomadaro timer process.' )
19
26
20
27
21
28
def get_duration_input (activity ):
22
- return input ("Please enter for how many minutes you would like to {}: " .format (activity ))
29
+ return int ( input ("Please enter a number for how many minutes you would like to {}: " .format (activity ) ))
23
30
24
31
32
+ def display_timer (duration , activity ):
33
+
34
+ print ()
35
+ print ("Starting new {} task" .format (activity ))
36
+
37
+ if duration == 1 :
38
+ print ("Now displaying {} timer for {} minute..." .format (activity , duration ))
39
+ elif duration > 1 :
40
+ print ("Now displaying {} timer for {} minutes..." .format (activity , duration ))
41
+
42
+ print ()
43
+
44
+ bar = progressbar .ProgressBar (widgets = [
45
+ progressbar .Bar (),
46
+ ])
47
+
48
+ for i in bar (range (duration * 60 )):
49
+ time .sleep (1 )
50
+
51
+ print ()
52
+ print ("{} task is done" .format (activity ))
53
+
25
54
if __name__ == '__main__' :
26
55
main ()
You can’t perform that action at this time.
0 commit comments