问答
Echo
1楼

联想截图_20250218200530.png

为啥我这个没有窗口

Echo
2楼

为啥300里面不用加双引号

Echo
3楼

为啥300里面不用加双引号

许墨辰
4楼

切换行是按什么键,我按回车不管用


尚新途

联系技术老师你给的提示太少了

南山梅花
5楼

pendown不是把箭头放下去了吗,为什么画圆的时候又在y=50的时候画了


尚新途

是不是又重新创建了

微信用户
6楼

微信图片_20250110201945.jpg

老师,我想问一下这个是什么问题啊?

尚新途

Libpng warning: iCCP: known incorrect sRGB profile

这些警告信息是由libpng库发出的,通常与图像处理有关。在这个上下文中,这些警告可能是由于使用了不正确的sRGB颜色配置文件。然而,这些警告通常不会影响程序的运行,只是提醒开发者可能存在一些图像处理上的问题。


Yu后天晴
7楼
分享一个犯的错,我创建了一个turtle.py文件,按照老师的代码进行输入,后面报了如下的错误:
Traceback (most recent call last):
File "E:\常用应用\Pycharm\Project\DAY1\turtle.py", line 1, in <module>
import turtle
File "E:\常用应用\Pycharm\Project\DAY1\turtle.py", line 3, in <module>
turtle.showturtle()   #显示箭头
^^^^^^^^^^^^^^^^^
AttributeError: partially initialized module 'turtle' has no attribute 'showturtle' (most likely due to a circular import)

这个错误是由于创建的 Python 文件名是 turtle.py,而 turtle 库本身也叫 turtle,导致了 Python 在导入时发生了循环导入(circular import)。具体来说,Python 会试图导入你当前的 turtle.py 文件,而不是标准库中的 turtle 模块,从而发生了冲突。

尚新途

我觉得你这个应该展示 

尚新途

图片已附上image.png

Aries
8楼

C:\Users\Administrator\PycharmProjects\mypro001\pythonProject\.venv\Scripts\python.exe C:\Users\Administrator\PycharmProjects\mypro001\pythonProject\my02.py 

Traceback (most recent call last):

  File "C:\Users\Administrator\PycharmProjects\mypro001\pythonProject\my02.py", line 3, in <module>

    turtle.showturtle() # 显示箭头

    ~~~~~~~~~~~~~~~~~^^

  File "<string>", line 6, in showturtle

  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python313\Lib\turtle.py", line 3844, in __init__

    Turtle._screen = Screen()

                     ~~~~~~^^

  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python313\Lib\turtle.py", line 3699, in Screen

    Turtle._screen = _Screen()

                     ~~~~~~~^^

  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python313\Lib\turtle.py", line 3710, in __init__

    _Screen._root = self._root = _Root()

                                 ~~~~~^^

  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python313\Lib\turtle.py", line 429, in __init__

    TK.Tk.__init__(self)

    ~~~~~~~~~~~~~~^^^^^^

  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python313\Lib\tkinter\__init__.py", line 2459, in __init__

    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)

              ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

_tkinter.TclError: Can't find a usable init.tcl in the following directories: 

    C:/Users/Administrator/AppData/Local/Programs/Python/Python313/lib/tcl8.6 C:/Users/Administrator/PycharmProjects/mypro001/pythonProject/.venv/lib/tcl8.6 C:/Users/Administrator/PycharmProjects/mypro001/pythonProject/lib/tcl8.6 C:/Users/Administrator/PycharmProjects/mypro001/pythonProject/.venv/library C:/Users/Administrator/PycharmProjects/mypro001/pythonProject/library C:/Users/Administrator/PycharmProjects/mypro001/pythonProject/tcl8.6.14/library C:/Users/Administrator/PycharmProjects/mypro001/tcl8.6.14/library




This probably means that Tcl wasn't installed properly.



进程已结束,退出代码为 1

尚新途

降低 python 版本, 现在最新版本的python 没有 海龟绘图的这个库,

空城
9楼

怎么运行不出现窗口image.png

尚新途

换成3.10的python

10楼
我这个是什么意思呢,编译器出错?

微信图片_20240708202300.png

尚新途

python环境原因,联系下技术老师,让他远程帮你下

憨憨家的大萝北
11楼

turtle模块没有导入成功

image.png

尚新途

文件名不能和模块名重名

挺住
12楼

微信截图_20240625225757.png

尚新途

怎么了吗

微信用户
13楼

老师,我运行了你的代码。还是不行。

image.png

尚新途

用管理员身份运行一下看看

微信用户
14楼

老师,我这个是不是安装环境有问题。完全是按课程内容打的。但就是跑不出来。似乎第一步的import就出问题了,无法引用。第一课的print是可以正常运行的。


image.png

尚新途
import turtle

# Create a screen object
screen = turtle.Screen()
screen.title("Turtle Graphics Example")
screen.bgcolor("white")  # Set background color

# Create a turtle object
t = turtle.Turtle()
t.shape("turtle")  # Set the turtle shape
t.color("blue")    # Set the turtle color

# Move the turtle forward
t.forward(100)

# Turn the turtle right by 90 degrees
t.right(90)

# Move the turtle forward
t.forward(100)

# Complete the square
t.right(90)
t.forward(100)
t.right(90)
t.forward(100)

# Hide the turtle
t.hideturtle()

# Keep the window open until it is closed by the user
screen.mainloop()

你执行一下这个代码看看

洋洋得易的易小姐~~
15楼

turtle 画的也不是海龟,为什么叫海龟作图?


尚新途

这个只是命名方式

自我检测(5S)