[Tutor] Non-blocking non-interactive graphics display
andorphin at gmail.com
Thu Jan 15 07:00:58 CET 2009
I am still getting my python legs (similar to sea legs but more
scale-y) and ran across a decision that I'd like some advice on.
I am looking for the simplest way of displaying a little positional
data as a line graphic in a window as a script runs.
#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)
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
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. I am not terribly familiar with threads and keen
to avoid them if they are unnecessary. The display is non-interactive
and so communication with it can be one-way. Ideally I would just be
able to get some interaction with a library that is similar to
processing (the graphics environment) which just lets me throw some
graphics primitives at it and gives me a nice window or saved file.
Bonus points if it is part of the Enthought Python Distribution and
Does anyone have any recommendations for a package to use for this and
a pointer to a particularly good tutorial or snippet of sample code?
More information about the Tutor