Reputation:
I want the top left corner to be the reference point (0,0) and the origin represented by other coordinates (x>0, y>0).
Upvotes: 1
Views: 5714
Reputation: 41872
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)
canvas.pack(side=tk.LEFT)
screen = turtle.TurtleScreen(canvas)
screen.setworldcoordinates(-10, 100, 100, -10)
turtle = turtle.RawTurtle(screen)
turtle.goto(90, 90)
screen.mainloop()
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.
Upvotes: 1
Reputation: 75
You can change coordinates using turtle.setworldcoordinates(llx, lly, urx, ury)
Documentation: https://docs.python.org/3.0/library/turtle.html#turtle.setworldcoordinates
Upvotes: 0