Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

kivy display PIL image

from kivy.core.image import Image as CoreImage
from kivy.uix.image import Image as kiImage
from PIL import Image, ImageDraw, ImageFont
from io import BytesIO

canvas_img = Image.new('RGB', (240, 120), color=(255, 255, 255))
(do stuff to canvas_img)
data = BytesIO()
canvas_img.save(data, format='png')
data.seek(0) # yes you actually need this
im = CoreImage(BytesIO(data.read()), ext='png')
self.beeld = kiImage() # only use this line in first code instance
self.beeld.texture = im.texture
Comment

PREVIOUS NEXT
Code Example
Python :: python invert colormap 
Python :: boto3 python s3 
Python :: python import as 
Python :: create array numpy 
Python :: hierarchy dendrogram 
Python :: task.loop discord.py 
Python :: null in python 
Python :: django admin.py date format 
Python :: print string python 
Python :: Send Fetch Post With Data Using Body 
Python :: python equivalent of R sample function 
Python :: django model choice field from another model 
Python :: pandas replace multiple values in column 
Python :: Broadcasting with NumPy Arrays Two dimension array dimension array Example 
Python :: How to check for string membership in python 
Python :: queue peek python 
Python :: python list remove duplicates keep order 
Python :: keras model 2 outputs 
Python :: filter in python 
Python :: remove dict last element 
Python :: how to do input python 
Python :: keras.callbacks.History 
Python :: how to write a function in python 
Python :: how to check if all values in list are equal python 
Python :: name is not defined python 
Python :: assignment operators in python 
Python :: python tkinter 
Python :: net way to print 2d array 
Python :: python index for all matches 
Python :: sort a list python 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =