# 环境:
VMware Test Servers:Windows Server 2016
Python 3.13
Python 集成开发环境(IDE):PyCharm 社区版(2024.2.3)
# 执行输出报错问题提示
This probably means that Tcl wasn't installed properly.
# 原因分析:
tkinter库环境变量出问题了
# 解决方法
# 定位python环境目录
C:\Users\Administrator\AppData\Local\Programs\Python\Python313\tcl\tcl8.6
C:\Users\Administrator\AppData\Local\Programs\Python\Python313\tcl\tk8.6
# 添加到电脑本地的环境变量
TCL_LIBRARY
TK_LIBRARY
重新打开pycharm输出完成,完美解决,并列出几个随意执行的基础代码展示。
import turtle
pen = turtle.Turtle()
pen.forward(10)
input()
import turtle
pen = turtle.Turtle()
pen.forward(100)
pen.left(50)
pen.forward(100)
input()
import turtle
pen = turtle.Turtle()
pen.speed(0)
for i in range(100):
pen.forward(100)
pen.left(50)
input()
import turtle
pen = turtle.Turtle()
pen.speed(0)
for i in range(100):
pen.forward(200)
pen.right(89)
input()
import turtle
pen = turtle.Turtle()
pen.speed(0)
for i in range(100):
pen.forward(100+i)
pen.right(61)
input()
import turtle
pen = turtle.Turtle()
pen.speed(0)
for i in range(100):
pen.forward(100+i)
pen.left(50)
pen.right(90)
pen.right(61)
input()
import turtle
pen = turtle.Turtle()
pen.write('hello',font=('Arial',40,'normal'))
input()
import turtle
from my_package import my_tools
pen = turtle.Turtle()
pen.speed(0)
times = my_tools.get_time()
pen.write(times,font=('Arial',20,'normal'))
input()
import time
import turtle
from my_package import my_tools
pen = turtle.Turtle()
pen.speed(0)
pen.backward(100)
while True:
time.sleep(1)
times = my_tools.get_time()
pen.clear()
pen.write(times,font=('Arial',20,'normal'))
input()