This is a code problem for Python 3.5.2 using John Zelle's graphics.py
:
I have spent a good amount of time looking for the answer here, but just can not figure it out. The function undraw()
exists just like getMouse()
. But it seems like it do not work for the plot()
command, only the draw()
command. What am I doing wrong? And how can I keep the window open, but erase the previous the plot before the next one is drawn?
pdf documentation for the functions of graphics
:
http://mcsp.wartburg.edu/zelle/python/graphics/graphics.pdf
win = GraphWin("Plot",500,500) # Creates a window
for m in range(0,j): # Loop for each function
# Randomizes a color for each function
color = random.choice( ['red','black','green','yellow','pink','blue'] )
for h in range(0,t): # Loop for each pair of values "x,y"
# Find points and plot each point in win
win.plot(axis[h],points[m][h],color)
win.getMouse() # Pause before clicking
win.undraw() # AttributeError: 'GraphWin' object has no attribute 'undraw'