Skip to content

The canvas cannot be cleared after running turtledemo clock #123370

Description

@Wulian233

Bug report

Bug description:

First, run turtledemo clock. Then stop

2024-08-27 095034

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.
2024-08-27 095211

Linked PRs

Activity

  1. deleted a comment from on Aug 27, 2024
  2. deleted a comment from amir1387aht on Aug 27, 2024
  3. hugovk commented on Aug 27, 2024

    @hugovk
  4. hugovk commented on Aug 27, 2024

    @hugovk
  5. terryjreedy commented on Aug 27, 2024

    @terryjreedy
    Member

    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') between tracer(False) and tracer(True) after t.clear() to remove previous writes. Colormixer also uses a one-time t.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.

  6. Wulian233 commented on Aug 27, 2024

    @Wulian233
    ContributorAuthor

    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

  7. added
    stdlibStandard Library Python modules in the Lib/ directory
    on Aug 29, 2024
  8. Wulian233 commented on Aug 30, 2024

    @Wulian233
    ContributorAuthor

    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!

  9. terryjreedy commented on Aug 31, 2024

    @terryjreedy
    Member

    I just added self as turtledemo codeowner. I'd like to see a follow-up 'modernize PR to

    1. 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.

    2. 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.

    1. In 'def hand', replace divisor in 'tip/2.0' with maybe 3.0 so just isosceles but not equilateral. What looks good to you?

    2. At end, remove creation and printing of 'msg' (main() call still needed though).

  10. Wulian233 commented on Aug 31, 2024

    @Wulian233
    ContributorAuthor
    1. 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

    1. 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

    1. In 'def hand', replace divisor in 'tip/2.0' with maybe 3.0 so just isosceles but not equilateral. What looks good to you?
    屏幕截图 2024-08-31 103752

    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

  11. terryjreedy commented on Oct 17, 2024

    @terryjreedy
    Member

    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.

    1. 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, winkel at the top of jump and modifying the rest of the body. Add stem, tip = laenge, spitze in hand and make_hand_shape. tick() has no parameters and the German local names can simply be changed.

    2. jump is 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.

  12. Wulian233 commented on Oct 17, 2024

    @Wulian233
    ContributorAuthor
    1. 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)

  13. added 3 commits that reference this issue on Oct 17, 2024
  14. added a commit that references this issue on Oct 17, 2024
  15. added a commit that references this issue on Oct 17, 2024
  16. added a commit that references this issue on Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions