Re: Tkinter: how to refresh a canvas without duplicates?

Discussion in 'Python' started by Fredrik Lundh, Feb 28, 2004.

  1. Stewart Midwinter wrote:

    > I've got a Tkinter app that draws three histograms. At this point I am
    > simulating real data by drawing rectangles whose size is defined by random
    > numbers; in the future there would be real data coming from a server.
    >
    > I want to redraw the rectangles every time I press the Again button. This works
    > for me, but I get an extra set of rectangles each time I press the Again button.
    > How to get rid of this effect?


    the create methods add new objects to the canvas. if you want
    to replace them, you can either get rid of the old objects (using
    delete(id) or even delete(ALL)) or you can modify the objects in
    place (itemconfig, coords).

    more info here:

    http://www.pythonware.com/library/tkinter/introduction/canvas.htm

    (see "item specifiers" under "concepts", and the "methods" section)

    if you need to rapidly redraw things in a Tkinter widget, the WCK is
    often a lot more efficient:

    http://www.effbot.org/zone/wck.htm

    </F>
    Fredrik Lundh, Feb 28, 2004
    #1
    1. Advertising

  2. Fredrik Lundh

    stewart Guest

    Fredrik Lundh wrote:

    > the create methods add new objects to the canvas. if you want
    > to replace them, you can either get rid of the old objects (using
    > delete(id) or even delete(ALL)) or you can modify the objects in
    > place (itemconfig, coords).


    thanks, that did the trick!

    > if you need to rapidly redraw things in a Tkinter widget, the WCK is
    > often a lot more efficient:
    >
    > http://www.effbot.org/zone/wck.htm


    I've tried to install this, but when I run 'python setup.py install', it
    complains that it "cannot find /usr/lib/python/2.3/config/Makefile". Why
    would this be?
    stewart, Feb 29, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stewart Midwinter
    Replies:
    0
    Views:
    422
    Stewart Midwinter
    Feb 28, 2004
  2. Stewart Midwinter
    Replies:
    0
    Views:
    487
    Stewart Midwinter
    Feb 28, 2004
  3. Askari
    Replies:
    2
    Views:
    697
    Askari
    Aug 30, 2004
  4. PhilC
    Replies:
    2
    Views:
    868
    PhilC
    Oct 25, 2004
  5. Replies:
    10
    Views:
    249
    Rick Johnson
    Mar 15, 2013
Loading...

Share This Page