Skip to content

Destroy the turtle window after its doctests finish #125294

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

zware
Copy link
Member

@zware zware commented Oct 11, 2024

@zware zware added tests Tests in the Lib/test dir docs Documentation in the Doc dir skip issue skip news labels Oct 11, 2024
@zware zware requested a review from AlexWaygood October 11, 2024 03:33
@zware zware requested a review from AA-Turner October 11, 2024 03:35
@AlexWaygood
Copy link
Member

This doesn't do it for me: the GUI window still sticks around with this chirpy message until all doctests have finished for all stdlib modules, long after the doctests for turtle specifically have finished:

image

@adorilson
Copy link
Contributor

This doesn't do it for me: the GUI window still sticks around with this chirpy message until all doctests have finished for all stdlib modules, long after the doctests for turtle specifically have finished:

Could you try again?

It works perfectly for me.

@zware
Copy link
Member Author

zware commented Aug 18, 2025

Which platforms are we all testing on? I had completely forgotten about this, but would have been on Linux.

@AA-Turner
Copy link
Member

AA-Turner commented Aug 19, 2025

I was testing on Windows, Alex's screenshot (above) looks like macOS.

@adorilson
Copy link
Contributor

Which platforms are we all testing on? I had completely forgotten about this, but would have been on Linux.

I'm on Ubuntu.

Maybe Alex (or someone on a macOS) could run:

>>> import turtle
>>> turtle.forward(100)
>>> turtle.bye()

I've asked a friend of mine to do this. In his case, the turtle window is gone. However, the Tk process was kept alive. He said that it is a macOS feature. And it is also different from Alex's case.

@zware
Copy link
Member Author

zware commented Aug 20, 2025

Two out of three isn't bad :). I wonder about going ahead with this since it will improve things for anyone on Windows or Linux, and if anyone can come up with a fix that works on macOS it can of course be patched in later.

Skimming through the turtle.py code, the only macOS-specific bit is an attempt to raise the window to the top so it doesn't get hidden behind the terminal, which I imagine shouldn't have an impact here. That leads me to believe that this may be a Tkinter and/or Tcl/Tk bug1, but I don't have the resources to investigate it right now.

Footnotes

  1. It might be interesting to see if this persists on macOS with Tcl/Tk 9

@AlexWaygood
Copy link
Member

Two out of three isn't bad :). I wonder about going ahead with this since it will improve things for anyone on Windows or Linux, and if anyone can come up with a fix that works on macOS it can of course be patched in later.

from memory, I don't think this made the situation any worse for me, so if it improves the situation on other platforms please go ahead!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting core review docs Documentation in the Doc dir skip issue skip news tests Tests in the Lib/test dir
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

4 participants