John Zelle の graphics.pyを参照すると、オブジェクトがウィンドウの端に到達して見えなくなったGraphWin
直後に を閉じたいと思います。Circle
次のコードは、円を作成して移動します。
win = GraphWin("My Circle", 100, 100)
c = Circle(Point(50,50), 10)
c.draw(win)
for i in range(40):
c.move(30, 0) #speed=30
time.sleep(1)
#c should move until the end of the windows(100),
win.close() # then windows of title "My Circle" should close immediately
range
「ステップ」の正確な数を使用してカウントする代わりに、これを行う方法はありますか?