question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ev3dev-lang-python, rpyc and PIL

See original GitHub issue

Hi again! This is not a issue. I am working with rpyc. I need big fonts for lcd screen!

I got a beautiful example in ev3python (thanks @ndward!)

#!/usr/bin/env python3
from ev3dev.ev3 import *
from PIL import Image, ImageDraw, ImageFont  
from time import sleep

lcd = Screen()

f = ImageFont.truetype('/usr/share/fonts/truetype/msttcorefonts/Arial.ttf', 75)
lcd.draw.text((3,0), 'Hello', font=f)
lcd.draw.text((2,55), 'world', font=f)
lcd.update()

sleep(7)  # if run from Brickman, need time to see displayed image

The problem is ImageFont. How i can import the remote PIL module (and Image, ImageDraw, ImageFont)? is it possible? Any example? Any workaround?

DJuego

P.S: I am considering seriously to use ev3dev and ev3dev lang python for robotic teaching. Interactive programming is so appealing… I only wish to get things done as simple as I can.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ddemidovcommented, Oct 28, 2016

However i don´t know how upgrade to the last development version the ev3dev

Here is what I do to get the latest version installed (on EV3):

sudo apt-get remove python3-ev3dev
git clone https://github.com/rhempel/ev3dev-lang-python
cd ev3dev-lang-python
python3 setup.py bdist
sudo python3 setup.py install --force
1reaction
ddemidovcommented, Oct 28, 2016

If you are using the latest developement version of ev3dev-lang-python (soon to be released as 0.7.1), then you can use bitmap fonts distributed with the library (see #225 and http://python-ev3dev.readthedocs.io/en/latest/other.html#bitmap-fonts for more details). The following works for me:

import rpyc
conn = rpyc.classic.connect('ev3dev')
ev3 = conn.modules['ev3dev.ev3']
fonts = conn.modules['ev3dev.fonts']
s = ev3.Screen()
s.draw.text((10,10), 'Hello World', font = fonts.load('luBS14'))
s.update()

If you are working with the latest released version (0.7.0), you may still use @ndward’s example you referenced. The only change is that you need to import PIL.ImageFont remotely:

ImageFont = conn.modules['PIL.ImageFont']
f = ImageFont.truetype('/usr/share/fonts/truetype/msttcorefonts/Arial.ttf', 75) # EV3 path
s.draw.text((10,10), 'Hello World', font=f)
s.update()
Read more comments on GitHub >

github_iconTop Results From Across the Web

RPyC - ev3python - Google Sites
Getting ready for a programming workflow based on using RPyC with your python IDE rather than using a terminal. Before you can use...
Read more >
Working with ev3dev remotely using RPyC
Install RPyC both on the EV3 and on your desktop PC. For the EV3, enter the following command at the command prompt (after...
Read more >
Part 1: Introduction to Classic RPyC - Read the Docs
The modules property of connection objects exposes the server's module-space, i.e., it lets you access remote modules. Here's how: rsys = conn.modules.sys # ......
Read more >
Part 3: Services and New Style RPyC
So far we have covered the features of classic RPyC. However, the new model of RPyC programming (starting with RPyC 3.00), is based...
Read more >
Part 2: Netrefs and Exceptions - RPyC - Read the Docs
In Part 1: Introduction to Classic RPyC, we have seen how to use rpyc classic connection to do almost anything remotely. So far...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found