Toggle Navigation
TiDAL Hatchery
Eggs
Marchdate
__init__.py
Users
Badges
Login
Register
__init__.py
raw
Content
import app from tidal import * import vga2_bold_16x32 as font from machine import RTC import wifi import time import ntptime class marchdate(app.TextApp): def on_activate(self): super().on_activate() datetime = RTC().datetime() ok = True if (datetime[0]==2000): ok = False self.window.println("syncing clock") self.window.println("wifi waiting") wifi.connect() if wifi.wait(): ntptime.settime() ok = True else: self.window.println("wifi failed!") if ok: march = str((time.time()-time.mktime((2020,3,0,0,0,0,0,0)))//86400)+"th" colour = color565(245, 234, 213) self.window.display.fill(colour) y = (240-font.HEIGHT)//2 x = (135-font.WIDTH * len(march)-1)//2 self.window.display.text(font, march, x, y, BLACK, colour) x = (135-font.WIDTH * 5)//2 self.window.display.text(font, "March", x, y - font.HEIGHT -3, RED, colour) x = (135-font.WIDTH * 4)//2 self.window.display.text(font, "2020", x, y + font.HEIGHT+3, BLUE, colour) main = marchdate