[IPython-user] Re: ipython and tkinter canvas

Prabhu Ramachandran prabhu_r at users.sf.net
Sun Nov 7 23:37:43 CST 2004


>>>>> "FP" == Fernando Perez <Fernando.Perez at colorado.edu> writes:

    FP> More info rom Rod Holland...
    >> So I discovered that if I do not run root.mainloop I can add to

Yes, mainloop will block, so if you don't call it you are set. 

    >> the image interactively (thats cool).  But the following does
    >> not work as a simple animation.

    >>
    >> for i in range(10):
    >> tg3=canvas.create_oval(0,0,10*i,10*i,fill='yellow')
    >> time.sleep(.5)

IIRC you need to call canvas.update_idletasks() or canvas.update().
Try them before you sleep and it might work.

In [3]: r.update?
Definition:     r.update(self)
Docstring:
    Enter event loop until all pending events have been processed by Tcl.

In [5]: r.update_idletasks?
Definition:     r.update_idletasks(self)
Docstring:
    Enter event loop until all idle callbacks have been called. This
    will update the display of windows but not process events caused by
    the user.


cheers,
prabhu




More information about the IPython-user mailing list