Open Aomferni opened 2 months ago
Type: Bug
mac@macs-MBP 商汤小浣熊 % /usr/local/bin/python3 /Users/mac/Documents/Working/1_Datawhale/1_学习内容 设计/3学习教程写作/产品从零到一教程产出/商汤小浣熊/Datawhale_AIX.py Exception in Tkinter callback Traceback (most recent call last): File
这个错误是因为在代码的 Loves.append(Ball()) 这一行,Ball 这个类没有被定义。但从代码中可以看出,应该没有使用到 Ball 这个类,所以这一行代码是多余的,可以删除。
Loves.append(Ball())
Ball
修复后的代码如下:
import turtle as tu import random as ra import tkinter as tk import math def Main(): tu.setup(1.0, 1.0) tu.screensize(1.0, 1.0) tu.bgcolor('black') tu.title("❤") t = tu.Pen() t.ht() words = [ "Datawhale AI+X,高校行足迹", "AI与X交辉,未来无限", "科技之花,校园开", "AI与X共舞,智慧未来", "智能科技,高校情", "AI与X交融,智慧无限", ] class Love: def __init__(self): self.x = ra.randint(-1000, 1000) self.y = ra.randint(-500, 500) self.f = ra.uniform(-3, 3) self.speed = ra.uniform(2, 5) self.word = ra.choice(words) self.color = "#%02x%02x%02 ## Raccoon's error engine is not available temporarily ## Your expection Extension version: 0.67.0 VS Code version: Code 1.87.2 (Universal) (863d2581ecda6849923a2118d93a088b0745d9d6, 2024-03-08T15:21:31.043Z) OS version: Darwin x64 22.6.0 Modes: <details> <summary>System Info</summary> |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 x 2800)| |GPU Status|2d_canvas: enabled<br>canvas_oop_rasterization: disabled_off<br>direct_rendering_display_compositor: disabled_off_ok<br>gpu_compositing: enabled<br>multiple_raster_threads: enabled_on<br>opengl: enabled_on<br>rasterization: enabled<br>raw_draw: disabled_off_ok<br>skia_graphite: disabled_off<br>video_decode: enabled<br>video_encode: enabled<br>webgl: enabled<br>webgl2: enabled<br>webgpu: enabled| |Load (avg)|6, 6, 6| |Memory (System)|16.00GB (0.04GB free)| |Process Argv|--crash-reporter-id e994b354-07e9-4911-98c7-3b88d70db325| |Screen Reader|no| |VM|0%| </details><details> <summary>A/B Experiments</summary>
vsliv368:30146709 vspor879:30202332 vspor708:30202333 vspor363:30204092 vswsl492cf:30256860 vscorecescf:30445987 vscod805cf:30301675 binariesv615:30325510 vsaa593:30376534 py29gd2263:30899288 c4g48928:30535728 azure-dev_surveyone:30548225 a9j8j154:30646983 962ge761:30959799 pythongtdpath:30769146 pythonidxpt:30866567 pythonnoceb:30805159 asynctok:30898717 pythontestfixt:30902429 pythonregdiag2:30936856 pyreplss1:30897532 pythonmypyd1:30879173 pythoncet0:30885854 h48ei257:31000450 pythontbext0:30879054 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 d34g3935:30971562 fegfb526:30981948 bg6jg535:30979843 ccp1r6:30993540 dsvsc020:30976470 pythonaic:30996667 7ghi1836:30988842 dsvsc021:30996838 gd77d436:30999572
</details> <!-- generated by issue reporter -->
Type: Bug
Your question
mac@macs-MBP 商汤小浣熊 % /usr/local/bin/python3 /Users/mac/Documents/Working/1_Datawhale/1_学习内容 设计/3学习教程写作/产品从零到一教程产出/商汤小浣熊/Datawhale_AIX.py Exception in Tkinter callback Traceback (most recent call last): File
Raccoon's answer
这个错误是因为在代码的
Loves.append(Ball())
这一行,Ball
这个类没有被定义。但从代码中可以看出,应该没有使用到Ball
这个类,所以这一行代码是多余的,可以删除。修复后的代码如下:
vsliv368:30146709 vspor879:30202332 vspor708:30202333 vspor363:30204092 vswsl492cf:30256860 vscorecescf:30445987 vscod805cf:30301675 binariesv615:30325510 vsaa593:30376534 py29gd2263:30899288 c4g48928:30535728 azure-dev_surveyone:30548225 a9j8j154:30646983 962ge761:30959799 pythongtdpath:30769146 pythonidxpt:30866567 pythonnoceb:30805159 asynctok:30898717 pythontestfixt:30902429 pythonregdiag2:30936856 pyreplss1:30897532 pythonmypyd1:30879173 pythoncet0:30885854 h48ei257:31000450 pythontbext0:30879054 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 d34g3935:30971562 fegfb526:30981948 bg6jg535:30979843 ccp1r6:30993540 dsvsc020:30976470 pythonaic:30996667 7ghi1836:30988842 dsvsc021:30996838 gd77d436:30999572