I am trying to draw a rectangle the same size as the screen on the turtle screen, but it goes across the border (is visible only when I enlarge window) but I need it all on screen.
The fragment of code:
WIDTH, HEIGHT = 280, 207
turtle = t.Turtle()
turtle.hideturtle()
turtle.speed(0)
turtle.penup()
turtle_screen = turtle.getscreen()
# coords should be in upper left corner
turtle_screen.setup(width = WIDTH + 20, height = HEIGHT + 20, startx = None, starty = None)
turtle_screen.setworldcoordinates(llx = -1, lly = WIDTH, urx = HEIGHT, ury = -1)
turtle.penup()
turtle.setpos(0, 0)
turtle.color('black', '#dbb4a0')
turtle.pendown()
turtle.begin_fill()
edges = [ WIDTH, HEIGHT, WIDTH, HEIGHT]
for edge in edges:
turtle.forward(edge)
turtle.left(90)
turtle.end_fill()
turtle_screen.exitonclick()
I am wondering if the inside screen has different coordinates than the size? Any ideas?