Created
October 21, 2020 13:09
-
-
Save ColdGrub1384/3b1ebec7c42d538faec3bb57f4d7627b to your computer and use it in GitHub Desktop.
Pyto Apple Watch Complication
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A watchOS complication for Pyto showing the current minute of the hour. | |
The script must be selected in Settings -> Apple Watch Script. | |
After running the script, | |
the complication named 'Minutes' should appear in the Watch Face customizer. | |
""" | |
import widgets as wd | |
import watch as wt | |
import datetime as dt | |
class MinutesProvider(wt.ComplicationsProvider): | |
def name(self): | |
return "Minutes" | |
def timeline(self, after_date, limit): | |
dates = [] | |
for i in range(limit): | |
delta = dt.timedelta(minutes=i*1) | |
date = after_date + delta | |
date = date.replace(second=0) | |
dates.append(date) | |
return dates | |
def complication(self, date): | |
min = date.time().minute | |
text = wd.Text(str(min), font=wd.Font.bold_system_font_of_size(20)) | |
complication = wt.Complication() | |
complication.circular.add_row([text]) | |
return complication | |
wt.add_complications_provider(MinutesProvider()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment