I am forced to use the plain PhotoImage class, since I had too many troubles installing PIL on the osx machine I use - I can live with it, resorting to use just GIF files.
Trouble is, there's a place where I really need to create a new image of a given color, size: just a simple colored square.
There is some way to do i开发者_JS百科t, à la Image.new('RGB', size, color)
?
from Tkinter import * #from tkinter
root = Tk()
i = PhotoImage(width=100, height=100)
l = Label(root, image=i)
l.pack()
i.put("{red}", to=(4,6,80,80))
root.update()
root.after(3000)
i.put("{blue}", to=(4,6,80,80))
root.mainloop()
精彩评论