fixing bug in phat display
This commit is contained in:
parent
ab4033c5fb
commit
8416412993
1 changed files with 4 additions and 3 deletions
|
|
@ -35,15 +35,16 @@ class InkyScreen(commands.Cog):
|
||||||
if text is not self.old_message:
|
if text is not self.old_message:
|
||||||
image = Image.new("P", (self.display.WIDTH, self.display.HEIGHT))
|
image = Image.new("P", (self.display.WIDTH, self.display.HEIGHT))
|
||||||
draw = ImageDraw.Draw(image)
|
draw = ImageDraw.Draw(image)
|
||||||
|
width = self.display.WIDTH
|
||||||
height = self.display.HEIGHT
|
height = self.display.HEIGHT
|
||||||
lines = len(text)
|
lines = len(text)
|
||||||
height_diff = height/lines
|
height_diff = height/lines
|
||||||
x = 0
|
x = 0
|
||||||
y = 0
|
y = 0
|
||||||
for line in text:
|
for line in text:
|
||||||
if x <= height:
|
if y <= width:
|
||||||
draw.text((x, y), line, self.display.YELLOW)
|
draw.text((x, y), line, self.display.BLACK)
|
||||||
x += height_diff
|
y += height_diff
|
||||||
else:
|
else:
|
||||||
self.bot.logger.warning("InkyScreen: Text too long to fit on image.")
|
self.bot.logger.warning("InkyScreen: Text too long to fit on image.")
|
||||||
self.display.set_image(image)
|
self.display.set_image(image)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue