Reputation: 1725
Hi i'm trying to get a set of points from matplotlib.pyplot.ginput.
my idea is to save points in a list while the actuaPoint!=lastPoint
is there a way to do it something like:
lastPoint = None
pointList = []
actualPoint = plt.ginput(1)
while (actualPoint=plt.input()) != lastPoint:
pointList.append(actualPoint)
lastPoint= actualPoint
? resuming i'm trying to know if there's a way to do the variable assignment inside the while statement
Upvotes: 0
Views: 72
Reputation: 531165
You need to use an assignment expression, using the :=
operator.
point, = pointList = [plt.ginput(1)]
while (next_point := plt.input()) != point:
pointList.append(next_point)
point = next_point
Upvotes: 1