-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Writing text to a specific position not working #58
Comments
I'm not able to set the position of the text to write... |
I'm getting the same thing. The file: |
That particular function is broken. I think it only gives a font size at
the moment
…On Sun, Dec 4, 2016 at 9:03 PM, BenScarb ***@***.***> wrote:
I'm getting the same thing.
The file:
/usr/local/lib/python2.7/dist-packages/papirus/text.py
doesn't have a function to take a (X,Y) parameter.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#58 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADNCuodqteEytWq6rL15lRhcW4dwC30Qks5rEyqsgaJpZM4J8scq>
.
|
It's pretty sad that such a basic functionality does not work out of the box and nobody tells you about that when you are buying the display. Nevertheless there is a simple workaround. You don't need the text module at all but you do need PIL (should be installed already if you have Papirus installed). Just do this: from papirus import Papirus
from PIL import Image, ImageDraw, ImageFont
# The epaper screen object
screen = Papirus()
# Create a new blank image with a size of the screen and get a drawing context
image=Image.new('1',screen.size, 1)
draw=ImageDraw.Draw(image)
# Specify a font you want to use and its size (last argument)
font=ImageFont.truetype('/usr/share/fonts/truetype/freefont/FreeMono.ttf',32)
# Draw text on the image at the desired position
draw.text((10,10),'Hello', font = font, fill = 0)
draw.text((10,60), 'World', font = font, fill = 0)
# Update the screen
screen.display(image)
screen.update() Hope it helps |
I've added in some positional text (PaPiRusTextPos) stuff, pull request is in. See if it's the sort of thing you want. |
Implemented in #68 |
Taking the snippet from the docs:
text.write("hello world", (10, 10) )
results in
The text was updated successfully, but these errors were encountered: