📜  python 如何在 tkinter 中添加海龟 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:11.419000             🧑  作者: Mango

代码示例1
from tkinter import *
from turtle import RawTurtle, TurtleScreen
"""
Will make a tk window and a TurtleScreen with a turtle in it
"""
root = Tk()              # the tk window
can = Canvas(root)       # a canvas what will turn into turtle screen
tsc = TurtleScreen(can)  # the screen inside tk window
tur = RawTurtle(tsc)     # the turtle; what you can do any turtle stuff with