Move origin from center to top left corner in Python turtle?


I want the top left corner to be the reference point (0,0) and the origin represented by other coordinates (x>0, y>0).

Asked By: user8193156



You can change coordinates using turtle.setworldcoordinates(llx, lly, urx, ury)


Answered By: custom_user

didn’t solve my real problem. i inserted a RawTurtle into a tkinter
Canvas. but i could not find the RawTurtle.setworldcoordinates method
as i find it in turtle.setworldcoordinates

import tkinter as tk
import turtle

root = tk.Tk()

canvas = turtle.ScrolledCanvas(root)

screen = turtle.TurtleScreen(canvas)
screen.setworldcoordinates(-10, 100, 100, -10)

turtle = turtle.RawTurtle(screen)
turtle.goto(90, 90)


You wrap the Tk canvas in a TurtleScreen and create your RawTurtle on that wrapped canvas. Then you can use setworldcoordinates() to manipulate the coordinate system.

Answered By: cdlane