From: Gael V. <gae...@no...> - 2006-10-30 14:45:32
|
On Mon, Oct 30, 2006 at 08:21:20AM -0600, John Hunter wrote: > blocking calls in pylab with gtk threading may be possible but it is > beyond my powers. I would write this with a callback, eg create a > class that takes a callback in the constructor and calls the callback > after n clicks with a list of n coords. Yes this is the right way of doing this (I have been experimenting a bit yesterday). However have a blocking call would be really nice for casual programmers, like so many physicists, who have no idea what eventloops and threads are. I think that for such a blocking call to work, all we would need is a way to start and stop the eventloop (I am talking in wx terms, the only GUI toolkit I know). That way when a script call ginput the ginput call adds a few callbacks to the canvas (that's the easy part) and starts the eventloop. The callbacks stop the eventloop when the right number of points as been acquired. Now I have no clue if this is possible, but that would certainly make writing small interactive scripts much easier. Cheers, Ga=EBl |