from PIL import Image as Im
from Tkinter import *
import Image
import ImageTk
# See PIL for valid modes
print x,y,mode
im=Im.new(mode, (x, y))
root=Tk()
canvas = Canvas(root, height=y, width=x)
canvas.pack(side=LEFT,fill=BOTH,expand=1)
root.update()
# st is a image string.
im.fromstring(st)
photo = ImageTk.PhotoImage(im)
item = canvas.create_image(0,0,anchor=NW, image=photo)
root.update()
No comments:
Post a Comment