pythonpython-3.xwindows-subsystem-for-linuxturtle-graphics

turtle doesn't show all executed movements after done


This code is supposed to create a square.

from turtle import Turtle, Screen, done

my_little_turtle = Turtle()
my_little_turtle.shape("turtle")
my_little_turtle.color("green")

my_screen = Screen()
my_screen.setup(600, 600, 1, 1)
my_screen.screensize(500, 500)

my_little_turtle.fd(200)
print("moved1")

my_little_turtle.right(90)
print("moved2")

my_little_turtle.fd(200)
print("moved3")

my_little_turtle.right(90)
print("moved4")

my_little_turtle.fd(200)
print("moved5")

my_little_turtle.right(90)
print("moved6")

my_little_turtle.fd(200)
print("moved7")

my_little_turtle.right(90)
print("moved8")

my_screen.exitonclick()

This creates the square but doesn't show it.

It shows it just created a line and stopped. But in the terminal, it prints all the "moved" prints.

Only when rewriting line 8 my_screen.setup(600, 600, 1, 1) to my_screen.setup(600, 600)It shows the full square while making it but the window is opened between my two monitors which is not ideal. If I don't change the line, it will show the full square only if I manually change the window size with the mouse. Unplugging the second monitor also lets the line do what it's supposed to do.

I tried setting this line's my_screen.setup(600, 600, 1, 1) last two values to both positive/negative/big/small, nothing worked. Only removing the last two values lets the code do what it was supposed to do. But then the window opens up in the middle of both my monitors. This code is running in a wsl.


Solution

  • Such a niche problem. Lowering the resolution of the second monitor to anything other than 1080p solved the issue.