Repository navigation
The canvas cannot be cleared after running turtledemo clock #123370
Description
Activity
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Aug 27, 2024 I'd like either the spam discussion deleted or the meat (opening post and below moved to a new issue and deleted here.
...
I am likely the current core dev with most turtledemo knowledge. Both clock and nim use(t:=Turtle()).write('text')betweentracer(False)andtracer(True)after t.clear() to remove previous writes. Colormixer also uses a one-timet.write(s)without touching tracer. After a couple of experiments, I still do not know why the screen reset and clear on restarts and loads does not work. A possible next move is to minimize clock until the ghost disappears.I deleted my own comment, leaving hugovk's. The bug now is that drawn text will not be cleared. I tried to solve this problem, including stopIt func
self.screen.clear() self.canvas.update() self.canvas.delete("all")
But all didn't work. I guess this bug has to do with
write- addedstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
on Aug 29, 2024 I submitted a PR yesterday, but I noticed that the turtledemo did not set the codeowner to review the request. Could Terry take a review please, Thanks!
I just added self as turtledemo codeowner. I'd like to see a follow-up 'modernize PR to
-
Replace module docstring with "turtledemo/clock.py -- clock program showing time and date." File name is wrong and instruction only applies when run in turtledemo, which it is redundant.
-
Replace German parameter names:
distanz, winkel = distance, angle
laenge, spitze = length, tip
'tip' is length of side of equilateral tip triangle; would consider another pair.
Or for 1 & 2, a new issue to also modernize other files with obsolete and bloated docstrings and German names and comments. Note that tearing off Examples menu makes it easy to look through files quickly.
-
In 'def hand', replace divisor in 'tip/2.0' with maybe 3.0 so just isosceles but not equilateral. What looks good to you?
-
At end, remove creation and printing of 'msg' (main() call still needed though).
-
- Replace module docstring with "turtledemo/clock.py -- clock program showing time and date." File name is wrong and instruction only applies when run in turtledemo, which it is redundant.
This problem is present in every file and can be changed in the new PR
- Replace German parameter names:
distanz, winkel = distance, angle
laenge, spitze = length, tip
'tip' is length of side of equilateral tip triangle; would consider another pair.
I've replaced this https://github.com/python/cpython/pull/123457/files
- In 'def hand', replace divisor in 'tip/2.0' with maybe 3.0 so just isosceles but not equilateral. What looks good to you?
I think it's uglier :(
Or new issue to also modernize this and other files with 1. obsolete and bloated docstrings and 2. German names and comments.
Agree
For suggestion 3, I forgot that changing the base length requires increasing the base angles and decreasing the tip angle (and changing the turns the opposite amount) so that the 2 half bases meet and the stem is still a single line.
-
Use English local names. Since these are invisible to users, this can be done even if parameter names are left alone. Example: add
distance, angle = distanz, winkelat the top ofjumpand modifying the rest of the body. Addstem, tip = laenge, spitzeinhandandmake_hand_shape.tick()has no parameters and the German local names can simply be changed. -
jumpis called 4 times, each with 1 argument. winkel/angle always defaults to 0, making the turns no-ops. If the remaining code were inlined, I believe some of the pen up/downs would no be needed. The resulting code might be clearer.
Before closing, I will open at least 2 new issues for changes that I think can and should be backported, with justifications.
-
- Use English local names. Since these are invisible to users, this can be done even if parameter names are left alone.
In this related PR, I ultimately decided to only fix this bug. However, on the left side of the turtledemo, users can see the code for the example case, so I don't want to add complexity and should try to keep it as simple as possible (for 5, backport should keep German names)
- added 3 commits that reference this issue
on Oct 17, 2024 - added a commit that references this issue
on Oct 17, 2024
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsDone
Bug report
Bug description:
First, run turtledemo clock. Then stop
When the clock stops running, the date appears, and the clear button becomes unusable. After switching to other files, the date still remains visible. Even after other files finish, pressing the clear button still cannot clear the date, but it can clear the drawings of the current file.

Linked PRs