猫史档案馆


【Python作品分享】clicks

用户:大圣牛柳大圣牛柳查看:0 回复:0 评论:0 创建时间:2022-06-04T11:41:50


【作品展示】

center_image

 

【作品介绍】

初学python

 

【作品源代码】

import pgzrun
import time
WIDTH=310
HEIGHT=450
score=0
button = Actor("button1_on")
button.pos = WIDTH/2, HEIGHT/2+60
def draw():
    screen.fill("lightblue")
    button.draw()
    screen.draw.text('Score:'+str(score),color='white',center=(WIDTH/2,90),fontsize=50)

def on_mouse_down(pos):
    global score
    if button.collidepoint(pos):
        button.image="button2_off"
        score+=1
        
    










pgzrun.go()
    

 

【提示】

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

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页