This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients terry.reedy
Date 2014-06-22.04:15:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1403410508.48.0.229814389673.issue21823@psf.upfronthosting.co.za>
In-reply-to
Content
When a turtle update operation cannot finish because the underlying canvas has been cleared (when the STOP button is pushed), turtle.Terminator is raised. When turtledemo runs the main function of a demo, it catches any Termininator raised before main returns. 

However, special demos leave an event loop running after main returns.  If the demo is free running, as with clock and minimal_hanoi, clicking STOP causes such exceptions.  (This is not be a problem with paint as updates only happen in response to mouse events on the canvas and complete before a user could move the mouse to the STOP button.)

This is the clock trackback, with common file prefix removed:
  \tkinter\__init__.py", line 1487, in __call__
    return self.func(*args)
  \tkinter\__init__.py", line 532, in callit
    func(*args)
  \turtledemo\clock.py", line 116, in tick
    second_hand.setheading(6*sekunde)
  \turtle.py", line 1935, in setheading
    self._rotate(angle)
  \turtle.py", line 3277, in _rotate
    self._update()
  \turtle.py", line 2659, in _update
    self._update_data()
  \turtle.py", line 2645, in _update_data
    self.screen._incrementudc()
  \turtle.py", line 1291, in _incrementudc
    raise Terminator

The hanoi traceback starts differently:
  \tkinter\__init__.py", line 1487, in __call__
    return self.func(*args)
  \turtle.py", line 686, in eventfun
    fun()
  \turtledemo\minimal_hanoi.py", line 53, in play
    hanoi(6, t1, t2, t3)
  ...<5 recursive calls deleted>
  \turtledemo\minimal_hanoi.py", line 36, in push
    to_.push(from_.pop())
  \turtledemo\minimal_hanoi.py", line 36, in push
    d.setx(self.x)
  \turtle.py", line 1807, in setx
    self._goto(Vec2D(x, self._position[1]))
  \turtle.py", line 3178, in _goto
  <last 3 lines as above>

These exceptions and tracebacks do not stop the master demo window, but are printed to the console (python -m turtledemo) or Idle Shell (open in editor, run). They are ugly, might unnecessarily alarm a naive user, or falsely teach that tracebacks are to be ignored.

In the patch to clock.tick, I put try: at the top, to be safe, although just before the update of the second hand might be good enough.
History
Date User Action Args
2014-06-22 04:15:08terry.reedysetrecipients: + terry.reedy
2014-06-22 04:15:08terry.reedysetmessageid: <1403410508.48.0.229814389673.issue21823@psf.upfronthosting.co.za>
2014-06-22 04:15:08terry.reedylinkissue21823 messages
2014-06-22 04:15:06terry.reedycreate