from turtle import goto
时间: 2023-08-15 19:08:37 浏览: 120
import turtle as t.py
`goto()` is a function in the `turtle` module of Python that moves the turtle to a specified position on the screen. Here's an example usage:
```
from turtle import Turtle, Screen
# create a turtle named "t" and a screen named "s"
t = Turtle()
s = Screen()
# move the turtle to the coordinates (100, 100)
t.goto(100, 100)
# close the screen when clicked
s.exitonclick()
```
This code creates a turtle named "t" and a screen named "s", then moves the turtle to the coordinates (100, 100) using `goto()`. Finally, it waits for a mouse click before closing the screen.
阅读全文