这是使用 John Zelle 的 Python 3.5.2 的代码问题graphics.py
:
我花了很多时间在这里寻找答案,但就是想不通。该函数的undraw()
存在就像getMouse()
. 但它似乎不适用于plot()
命令,仅适用于draw()
命令。我究竟做错了什么?以及如何保持窗口打开,但在绘制下一个情节之前擦除上一个情节?
pdf 文档的功能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'