For ginput, there are a number of ways that an impartial list could be
returned and this is often a desired outcome (for example, I often
decide after the fact that I want fewer points than I initially
thought).
Can't you use ginput(0) for these cases?
It doesn't work on Mac with no middle mouse button to terminate the
sequence, but that is a separate issue.
Perhaps as a compromise we could set the default timeout to
-1 so the user needs to actually choose a timeout (presumably indicating
he/she accepts the consequences). But allowing the user to manually
decide to select fewer points using the second mouse button has proved
quite useful to me and the user would still need to test in this case.
We could warn if not enough points are returned, but an error seems too
much to me.
The cases I'm thinking about (e.g., select fit range) have a specific
number of points. Other cases (e.g., select shape outline) have an
indefinite number of points. I can't think of case off hand where
I would want e.g., six or fewer points.
That said, I can always wrap the function in my own interface for my
scripts.
- Paul
···
On Fri, Jul 18, 2008 at 09:17:02PM +0200, David M. Kaplan wrote:
Hi,
The cases I'm thinking about (e.g., select fit range) have a specific
number of points. Other cases (e.g., select shape outline) have an
indefinite number of points. I can't think of case off hand where
I would want e.g., six or fewer points.
A good use case of this is a nested zoom functionality - I often use the
following code to implement a simple nested zoom to look at areas of
figures while flipping through a large series of figures (i.e., in cases
where stopping and restarting the code is a bit awkward):
while True:
x = ginput(2)
if len(x)<2: break
x.sort(0)
axis(x.T.ravel())
Another use is drawing a contour as you click points.
I am still thinking that changing the default timeout to -1 is a good
idea - this agrees with matlab and forces the naive user to choose fewer
points rather than inadvertantly letting it happen.
Cheers,
David
···
On Fri, 2008-07-18 at 15:47 -0400, Paul Kienzle wrote:
--
**********************************
David M. Kaplan
Charge de Recherche 1
Institut de Recherche pour le Developpement
Centre de Recherche Halieutique Mediterraneenne et Tropicale
av. Jean Monnet
B.P. 171
34203 Sete cedex
France
Phone: +33 (0)4 99 57 32 27
Fax: +33 (0)4 99 57 32 95
http://www.ur097.ird.fr/team/dkaplan/index.html
**********************************