I just try to run a simple Python turtle program. It works before, but now the same code doesn't work with errror as follow. Anyone can help. Thanks

Problem description:
I just try to run a simple Python turtle program. It works before, but now the same code doesn’t work with error as follows. Anyone can help. Thanks.

Expected behavior:
no error

Actual behavior:

Traceback (most recent call last):
  File "main.py", line 38, in <module>
    wn = turtle.Screen()
  File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/turtle.py", line 3664, in Screen
    Turtle._screen = _Screen()
  File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/turtle.py", line 3680, in __init__
    _Screen._root = self._root = _Root()
  File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/turtle.py", line 435, in __init__
    TK.Tk.__init__(self)
  File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/tkinter/__init__.py", line 2299, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: couldn't connect to display ":0"

Steps to reproduce:

Bug appears at this link:

Browser/OS/Device:

Look at the banner shown on the top of every forum page