没有出现名为“tkinter”的模块错误

2024-10-03 09:10:24 发布

您现在位置:Python中文网/ 问答频道 /正文

我一直试图在VisualStudio2019社区版中运行某个turtle代码

但是我一次又一次地犯这个错误。 另外,普通python在VS ide上运行良好

错误

  Message=No module named 'tkinter'

  Source=D:\visual studio\python trials\day6trial\example\example\example.py
  StackTrace:

  File "D:\visual studio\python trials\day6trial\example\example\example.py", line 1, in <module>
    
from turtle import *

我一直试图运行的代码是:

from turtle import *


speed(0)

bgcolor('black')

x = 1

while x < 400:

     colormode(255) # this is something that is irrelevant at this point
                # check the pythondocs link at the end for more info


     pencolor(255,255,255) # changes the color of the pen to the rgb coordinates
                     # obtained by the variables r, g, b changing each time

     fd(50 + x)
     rt(90.911)


     x = x+1 

exitonclick() 

自从我在笔记本电脑上安装了nodejs和vscode以来,这个问题就一直存在

请帮忙


Tags: the代码frompyimportisexample错误