import cairo from datetime import datetime import gtk import math import pango import clock def get_name(): return "ISO_8601 Clock" class ISO_8601_Clock(clock.Clock): def __init__(self, drawing_area): clock.Clock.__init__(self, drawing_area) def draw_clock(self): # Draw date.in ISO-8601 compliant self.context.set_font_size(20) self.context.move_to(2, 16) text = str(self.time.year) + "." + str(self.time.month).zfill(2) + "." + str(self.time.day).zfill(2) self.context.text_path(text) self.context.stroke() # Draw time. self.context.set_font_size(20) self.context.move_to(2, 35) text = str(self.time.hour).zfill(2) + ":" + str(self.time.minute).zfill(2) + ":" + str(self.time.second).zfill(2) self.context.text_path(text) self.context.stroke() def resize(self): self.drawing_area.set_size_request(110, 36)