Changing fill in tkinter

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


On 13 Jan 2006 01:43:42 -0800, venk <venkatasubramanian at gmail.com> 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  
itemconfigure:

>>> 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?

HTH
-- 
python -c "print ''.join([chr(154 - ord(c)) for c in  
'U(17zX(%,5.zmz5(17;8(%,5.Z65\'*9--56l7+-'])"



More information about the Python-list mailing list