counts showing
This commit is contained in:
parent
5fc486ec39
commit
c1e0f8bbaf
26
good.py
26
good.py
|
@ -46,13 +46,13 @@ def get_goodreads_stats():
|
|||
def get_stats(pages, books):
|
||||
coords = {
|
||||
"year": [
|
||||
(55, 17),(109,17),(163,17)
|
||||
(53, 17),(107,17),(161,17)
|
||||
],
|
||||
"books": [
|
||||
(55, 45),(109,45),(163,45)
|
||||
(53, 45),(107,45),(161,45)
|
||||
],
|
||||
"pages": [
|
||||
(55, 75),(109,75),(163,75)
|
||||
(53, 75),(107,75),(161,75)
|
||||
],
|
||||
}
|
||||
_stats = []
|
||||
|
@ -71,17 +71,23 @@ def draw(stats):
|
|||
inkyphat.set_colour(colour)
|
||||
inkyphat.set_border(inkyphat.RED)
|
||||
inkyphat.set_image("./background.png")
|
||||
font = ImageFont.truetype(inkyphat.fonts.AmaticSCBold, 18)
|
||||
|
||||
for column in ('year', 'books', 'pages'):
|
||||
for year in stats:
|
||||
count = year[column][0]
|
||||
x,y = year[column][1]
|
||||
w, h = font.getsize(count)
|
||||
inkyphat.text((x, y), count, inkyphat.BLACK, font)
|
||||
draw_row('year', stats, 12)
|
||||
draw_row('books', stats, 14)
|
||||
draw_row('pages', stats, 10)
|
||||
|
||||
inkyphat.show()
|
||||
|
||||
def draw_row(row, stats, size):
|
||||
#font = ImageFont.truetype(inkyphat.fonts.PressStart2P, size)
|
||||
font = ImageFont.truetype(inkyphat.fonts.FredokaOne, size)
|
||||
#font = ImageFont.truetype(inkyphat.fonts.AmaticSC, size)
|
||||
for year in stats:
|
||||
count = year[row][0]
|
||||
x,y = year[row][1]
|
||||
w, h = font.getsize(count)
|
||||
inkyphat.text((x, y), count, inkyphat.BLACK, font)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user