[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Re: The stange behaviour of Tkinter.Canvas

John McMonagle

3/11/2008 11:33:00 PM

James Yu wrote:
> I tried to update the rectangle on a canvas to get the visual effect of
> progressbar.
> It works all right if I delete the existing objects (rectangle and text)
> and create a new one.
> However, if I invoke canvas.itemconfig() to update the existing objects'
> options, gui just went nuts.
> I am more than happy to receive any help and advise.
>

Snipped code

> canv.itemconfig(rect, width=width*progress/100) ##

The width option of a rectangle item does not change the rectangles
width, but changes the width of the rectangle perimiter line.

You need to modify the coordinates of the rectangle item:

canv.coords(rect, 0, 0, width*progress/100, height)

Regards,

John