Skip to content

gh-123370: Fix the canvas not clearing after running turtledemo.clock #123457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Oct 17, 2024

Conversation

Wulian233
Copy link
Contributor

@Wulian233 Wulian233 commented Aug 29, 2024

In addition to fixing this bug, I also made some changes.

  1. The second hand was shorter than the minute hand, which was incorrect, and this has now been fixed. (minute hand 130 → 115)
  2. Remove the first line's coding: cp1252, as this file has always been utf8.
2024-08-29 093847 2024-08-29 093936

Copy link
Member

@terryjreedy terryjreedy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Needs one change and one question answered. I also need to verify that we can remove functions. I suggested other changes on issue for other PR/issue.

@bedevere-app
Copy link

bedevere-app bot commented Aug 31, 2024

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@terryjreedy terryjreedy changed the title gh-123370: Fix the canvas not clearing after running turtledemo clock and improve the clock example suite gh-123370: Fix the canvas not clearing after running turtledemo.clock Aug 31, 2024
@Wulian233
Copy link
Contributor Author

Wulian233 commented Sep 1, 2024

I have made the requested changes; please review again
The time is now dynamically updated, and the date is refreshed only once when the day changes. The cause of this bug is that the text was being refreshed every second 🚀 🕙

bandicam.2024-09-01.19-56-12-916.mp4

@bedevere-app
Copy link

bedevere-app bot commented Sep 1, 2024

Thanks for making the requested changes!

@terryjreedy: please review the changes made to this pull request.

@bedevere-app bedevere-app bot requested a review from terryjreedy September 1, 2024 11:58
@bedevere-app
Copy link

bedevere-app bot commented Sep 4, 2024

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@Wulian233
Copy link
Contributor Author

Wulian233 commented Sep 4, 2024

I have made the requested changes; please review again

Thank you for your review again. In the previous clock.py, the parameters used in the calls to the functions datum(z) and wochentag(t) were t = datetime.today(). These functions return the date (such as month, day, year) or the day of the week

https://github.com/python/cpython/blob/main/Lib/turtledemo/clock.py#L82-L93

https://github.com/python/cpython/blob/main/Lib/turtledemo/clock.py#L105-L105

Now wochentag and datum functions now ensure that the parameters and functionality are same (Because both use the datetime module)

def wochentag(t): 
     return t.strftime(format="%A") 
  
 def datum(z): 
     return z.strftime(format="%Y/%m/%d")

@bedevere-app
Copy link

bedevere-app bot commented Sep 4, 2024

Thanks for making the requested changes!

@terryjreedy: please review the changes made to this pull request.

@bedevere-app bedevere-app bot requested a review from terryjreedy September 4, 2024 12:37
@terryjreedy terryjreedy merged commit c124577 into python:main Oct 17, 2024
35 of 38 checks passed
@terryjreedy
Copy link
Member

You reverted more than I requested, but moving the other changes, which I do want, to a separate cleanup/modernize backported PR is fine.

@terryjreedy terryjreedy added needs backport to 3.12 only security fixes needs backport to 3.13 bugs and security fixes labels Oct 17, 2024
@miss-islington-app
Copy link

Thanks @Wulian233 for the PR, and @terryjreedy for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Thanks @Wulian233 for the PR, and @terryjreedy for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Sorry, @Wulian233 and @terryjreedy, I could not cleanly backport this to 3.12 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker c124577ebe915a00de4033c0f7fa7c47621d79e0 3.12

@terryjreedy terryjreedy added the type-bug An unexpected behavior, bug, or error label Oct 17, 2024
@miss-islington-app
Copy link

Sorry, @Wulian233 and @terryjreedy, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker c124577ebe915a00de4033c0f7fa7c47621d79e0 3.13

@terryjreedy terryjreedy removed the type-bug An unexpected behavior, bug, or error label Oct 17, 2024
terryjreedy pushed a commit to terryjreedy/cpython that referenced this pull request Oct 17, 2024
…tledemo.clock (pythonGH-123457)

Rewriting the day and date every tick somehow prevented them from being removed either by clicking STOP or loading another example.  The solution is to rewrite them only when they change.
(cherry picked from commit c124577)

Co-authored-by: Wulian <[email protected]>
@terryjreedy
Copy link
Member

terryjreedy commented Oct 17, 2024

Merge conflict explained at #118673 (comment). This will impact (edit) docstring changes in the rest of turtledemo files. I have fixed this one for 3.13 and will backport that PR.

@bedevere-app
Copy link

bedevere-app bot commented Oct 17, 2024

GH-125653 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Oct 17, 2024
@python python deleted a comment from bedevere-app bot Oct 17, 2024
@terryjreedy terryjreedy removed the needs backport to 3.12 only security fixes label Oct 17, 2024
terryjreedy added a commit that referenced this pull request Oct 17, 2024
…o.clock (gh-123457) (#125653)

[3.13] gh-123370: Fix the canvas not clearing after running turtledemo.clock (GH-123457)

Rewriting the day and date every tick somehow prevented them from being removed either by clicking STOP or loading another example.  The solution is to rewrite them only when they change.
(cherry picked from commit c124577)

Co-authored-by: Wulian <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 17, 2024
…tledemo.clock (pythongh-123457) (pythonGH-125653)

[3.13] pythongh-123370: Fix the canvas not clearing after running turtledemo.clock (pythonGH-123457)

Rewriting the day and date every tick somehow prevented them from being removed either by clicking STOP or loading another example.  The solution is to rewrite them only when they change.
(cherry picked from commit c124577)

(cherry picked from commit 30d7e9e)

Co-authored-by: Terry Jan Reedy <[email protected]>
Co-authored-by: Wulian <[email protected]>
terryjreedy added a commit that referenced this pull request Oct 17, 2024
…rtledemo.clock (gh-123457) (GH-125653) (#125656)

Rewriting the day and date every tick somehow prevented them from being removed either by clicking STOP or loading another example.  The solution is to rewrite them only when they change.
(cherry picked from commit c124577)

(cherry picked from commit 30d7e9e)

Co-authored-by: Terry Jan Reedy <[email protected]>
Co-authored-by: Wulian <[email protected]>
@Wulian233 Wulian233 deleted the clock branch October 17, 2024 22:22
ebonnal pushed a commit to ebonnal/cpython that referenced this pull request Jan 12, 2025
….clock (python#123457)

Rewriting the day and date every tick somehow prevented them from being removed either by clicking STOP or loading another example.  The solution is to rewrite them only when they change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants