I am looking for an app for my Moto e6 android phone that will accept a number
of hours and then count down. Once the hours have been executed, it will
quietly beep every minute until I cancel the app. This is to remind me (and
keep on reminding me) when to take my insulin.
It has been written in python but I do not know how to convert it to an app. I
wonder how much of the python code will still apply. When I was into this in
the past, I installed Kivy and was able to finally generate a "Hello World" app
and managed to get it to my phone. Then life called me back to reality and I
lost track of what I was doing for a few years. )-: I doubt I can go through
that installation and learning curve again.
It works on my computer but I have projects that interfere with the alarm.
This is why I would prefer to have it on my phone.
I appreciate any assistance you can provide.
Steve
I attached the py code but wonder if it will carry with the message. It is
about 100 lines of code but that includes a few ops and whistles that are
probably not needed in the app.
--------------------------------------------------------------------------------------------
There's 99 bugs in the code, in the code.
99 bugs in the code.
Take one down and patch it all around.
Now there's 117 bugs in the code.
## Copyright Ambrosini 2017
import re
import random
import time
import datetime
from datetime import datetime
global AX
global ax
AX = 0
AX += 1
ax = str(AX)
#print(" ax = " + ax)
import winsound #as ws
from time import gmtime, strftime ##define strftime as time/date right now
nowTimeDate2=strftime("%Y %a %b %d %H:%M") ##Capture right now Time/date.
print()
print()
print(" " + nowTimeDate2)
print()
global delayTime
global DelayTime
print()
print()
print(" Enter 0 to test the alarm section.")
delayTime = input(" How many hours to next insulin check? (3) ")
if delayTime == "":
delayTime = 3
DelayTime = int(delayTime)
winsound.MessageBeep(-1)
print()
# =================================================
def Alarm(D):
AX = 0
while D >= 1:
d = str(D)
AX += 1
ax = str(AX)
print(' ' + ax, end='...' + "\n")
time.sleep(60)
D -= 1
import winsound #as wsBeep
winsound.MessageBeep(1)
def countdown(DelayTime):
import time
t = str(DelayTime)
if t == "1":
print(" An alarm will start sounding in " + t + " hour...")
else:
print(" An alarm will start sounding in " + t + " hours...")
while DelayTime >= 1:
t = str(DelayTime)
import datetime
from datetime import datetime
from time import gmtime, strftime ##define strftime as time/date right
now
nowTimeDate2=strftime("%Y %a %b %d %H:%M") ##Capture right now
Time/date.
Yz=nowTimeDate2[0:4]
mz=nowTimeDate2[9:12]
dz=nowTimeDate2[13:15]
Hz=nowTimeDate2[16:18]
Mz=nowTimeDate2[19:22]
def month_converter(month): ##convert text month to number
months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug',
'Sep', 'Oct', 'Nov', 'Dec']
return months.index(month) + 1
mz = month_converter(mz)
Hz = int(Hz)
AmPm = " AM"
if Hz > 12:
Hz = Hz - 12
if Hz == 0:
Hz = 12
AmPm = " PM"
if Hz == 0:
Hz = 12
AmPm = " AM"
Yz = str(Yz)
mz = str(mz)
dz = str(dz)
Hz = str(Hz)
Mz = str(Mz)
Tz = (" " + mz + "-" + dz + "-" + Yz + " " + Hz + ":" + Mz + AmPm)
print(' ' + t + " " + Tz + "\n")
time.sleep(3600)
DelayTime -= 1
import winsound as wsBeep
wsBeep.MessageBeep(1)
print(' More Insuin? \n \n \n \n \n')
Alarm(30000)
countdown(DelayTime)
EOB = input(" Strike any key to continue")
--
https://mail.python.org/mailman/listinfo/python-list