[Tutor] Non-blocking non-interactive graphics display

Kent Johnson kent37 at tds.net
Thu Jan 15 13:32:05 CET 2009


On Thu, Jan 15, 2009 at 1:00 AM, David Williams <andorphin at gmail.com> wrote:

> I am looking for the simplest way of displaying a little positional
> data as a line graphic in a window as a script runs.
>
> Something like:
>
>        #Set up some points
>        pt1 = (0,0)
>        pt2 = (2,1)
>        pt3 = (3,2)
>        #Create a window that displays the points as two lines connected at pt2
>        import somethingsomething #maybe something like import enthought.enable
>        window = somethingsomething.graph_points_as_line(pt1,pt2,pt3)
>        #Iterate
>        for i in range(0,100):
>                #Change the points slightly, this takes a bit of time
>                [pt1, pt2, pt3] = update_points_with_derived_values(pt1,pt2,pt3)
>                #Update the display
>                window.graph_points(pt1,pt2,pt3)
>
> My problem is that using tkinter, it looks to be a bit difficult to
> get this to work since showing the window blocks the rest of the
> script from running.

A little more context might help. What is the rest of the script
doing? Is it the update points that is being blocked?

tkinter supports animation. Here is an example of animation in tkinter
that might help:
http://effbot.org/zone/tkinter-animation.htm

Kent


More information about the Tutor mailing list