0

I want to pass integer value instead of String, say a = 45, but it's not working!

import Image
import ImageDraw
import ImageFont


width = disp.width
height = disp.height
image = Image.new('1', (width, height))

font = ImageFont.load_default()
a = 45

draw.text((x, top), a ,  font=font, fill=255)
draw.text((x, top+20), 'World!', font=font, fill=255)
Ammar Ashraf
  • 61
  • 3
  • 10

1 Answers1

1

Cast a to a string using draw.text((x, top), str(a) , font=font, fill=255).

You could also use a = '45' defining it as a string. However I would advise against this as you may want to use it as an integer before drawing it.

jc1850
  • 1,101
  • 7
  • 16