The program gets stuck at the graph even though i use plt.show(block=False). I want to be able to close the graph and after x amount of time and plot something else but it doesn't work.
Sorry about this I have now uploaded the code needed for it to run.
import matplotlib.pyplot as plt import time
class Point: def init(self, x, y): self.x = x self.y = y
def plot(self):
fig = plt.scatter(self.x, self.y)
def __add__(self, other):
if isinstance(other, Point):
x = self.x + other.x
y = self.y + other.y
return Point(x, y)
else:
x = self.x + other
y = self.y + other
return Point(x, y)
def main():
a = Point(1, 1)
b = Point(2, 2)
c = a + b
e = Point(0, 2)
d = e + 5
f = a + Point(1, 1)
listAZ = [a, b, c, d, e, f]
for i in listAZ:
i.plot()
plt.show(block=False)
plt.show()
time.sleep(5)
plt.close()
The only thing is i need the program to continue executing after this line. I want the plot the graph then pause a bit and continue with the rest of the code.
Indentation is correct. There is no problem with that.