25 lines
672 B
Python
25 lines
672 B
Python
from PIL import Image, ImageDraw
|
|
|
|
|
|
class ClockApp:
|
|
kind = 'clock'
|
|
title = 'Часы'
|
|
icon = 'C'
|
|
cmd = 'clock'
|
|
|
|
def __init__(self):
|
|
pass
|
|
|
|
def render(self, fonts, bg, now):
|
|
img = Image.new('1', (128, 64), 0)
|
|
d = ImageDraw.Draw(img)
|
|
d.text((64, 20), now.strftime("%H:%M:%S"),
|
|
font=fonts['big'], fill=1, anchor="mm")
|
|
d.text((64, 44), "Esc - выход",
|
|
font=fonts['small'], fill=1, anchor="mm")
|
|
return img
|
|
|
|
def handle_key(self, code, mods, system):
|
|
# Clock никаких клавиш не обрабатывает; Esc = system-level.
|
|
return False
|