rm-hull / luma.examples

Companion repo for running examples against the luma.oled, luma.lcd, luma.led_matrix and luma.emulator display drivers.
MIT License
370 stars 144 forks source link

How to draw.text a variable? #82

Closed craver2000 closed 6 years ago

craver2000 commented 6 years ago

I refer to the example script in demo.py. I want to display a variable, how do I go about doing that?

I included var which is my variable after the string of fixed text like this: draw.text((device.width - padding - size[0], top + 32), 'Variable status is:', var, fill="white")

But I got an error on terminal:

TypeError: text() got multiple values for keyword argument 'fill'

I also tried draw.text((device.width - padding - size[0], top + 32), 'Variable status is: %s', fill="white") %var

How can I print variables in a draw.text function?

rm-hull commented 6 years ago
draw.text((device.width - padding - size[0], top + 32), 'Variable status is: %s' % var, fill="white")