猫史档案馆


【Python作品分享】help!help!【求助帖】

用户:是时候展现真正的实力了_加油是时候展现真正的实力了_加油查看:1 回复:2 评论:1 创建时间:2019-07-10T07:56:39


【作品展示】

center_image

 

【作品介绍】

求助一下,这个作品总报错(而且是第一行代码),时间紧急,所以随便选了张图片

 

【作品源代码】

from tkinter import
import random
import time


class Ball:
    def init (self, canvas, paddle, color):
        self.canvas = canvas
        self.paddle = paddle
        self.id = canvas.create oval(10, 10, 25, 25, fill=color)
        self.canvas.move(self.id, 245, 100)
        starts = [-3, -2, -1, 1, 2, 3]
        random.shuffle(starts)
        self.x = starts[0]
        self.y = -3
        self.canvas height = self.canvas.winfo height()
        self.canvas width = self.canvas.winfo width()
        self.hit bottom = False

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
天上的流星_tianqiVirus天上的流星_tianqiVirus

你第一行import后面一定要跟一个库或者用法,比如from random import randint,要么你可以改成import *

点赞0


评论


硫酸QwQ硫酸QwQ

第一行少了一个*

应改为:

from tkinter import *

点赞1


评论