Changing fill in tkinter

Eric Brunel eric_brunel at
Fri Jan 13 06:00:04 EST 2006

On 13 Jan 2006 01:43:42 -0800, venk <venkatasubramanian at> wrote:

> Hi,
>      I would like to know how to change the fill of things we put in a
> tkinter's canvas. for example, if i create a rectangle and i would want
> to change the fill of the rectangle once it is clicked... can we do
> that?

Not sure if I correctly understand your question, but you seem to look for  

>>> from Tkinter import *
>>> root = Tk()
>>> c = Canvas(root)
>>> c.pack()
>>> r = c.create_rectangle(20, 20, 60, 60)
>>> c.itemconfigure(r, fill='blue')

Is that what you were after?

python -c "print ''.join([chr(154 - ord(c)) for c in  

More information about the Python-list mailing list