[Tutor] Non-blocking non-interactive graphics display
David Williams
andorphin at gmail.com
Thu Jan 15 07:00:58 CET 2009
Hi All,
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.
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. 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
pleasingly anti-aliased.
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?
Thanks much,
Dave
More information about the Tutor
mailing list