|
From: John H. <jdh...@ac...> - 2006-10-30 14:53:00
|
>>>>> "Gael" == Gael Varoquaux <gae...@no...> writes:
Gael> 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.
Gael> Yes this is the right way of doing this (I have been
Gael> experimenting a bit yesterday). However have a blocking call
Gael> would be really nice for casual programmers, like so many
Gael> physicists, who have no idea what eventloops and threads
Gael> are.
Gael> I think that for such a blocking call to work, all we would
Gael> need is a way to start and stop the eventloop (I am talking
Gael> in wx terms, the only GUI toolkit I know). That way when a
Gael> script call ginput the ginput call adds a few callbacks to
Gael> the canvas (that's the easy part) and starts the
Gael> eventloop. The callbacks stop the eventloop when the right
Gael> number of points as been acquired.
Gael> Now I have no clue if this is possible, but that would
Gael> certainly make writing small interactive scripts much
Gael> easier.
Nadia pursued blocking calls for a while and I think she made some
progress. You are right about this model fitting the brain of
physicists better than a callback approach. Maybe Nadia can bring us
up to speed on where she left off.
JDH
|