python幸运大抽奖大转盘粗犷风格小程序

python 幸运大抽奖大转盘by李兴球lixingqiu

"""幸运大抽奖小程序,本作品要求安装pygame模块才有声音
按空格键开始抽奖。
"""

# 1、模块导入
import sys
from turtle import *
from random import randint

# 2、屏幕初始化 
screen = Screen()
screen.title("幸运大抽奖 by lixingqiu")
screen.setup(800,600)
screen.bgpic("转盘.png")
screen.delay(0)
vertex = ((0,0),(25,0),(25,100),(50,100),(0,150),(-50,100),(-25,100),(-25,0)) # 顶点表
screen.addshape("bigarrow",vertex)                        # 添加大箭头各顶点到形状列表

# 3、加载造型列表 
sprite1_images = ["anjuli-1.gif","anjuli-2.gif","anjuli-3.gif","anjuli-4.gif","anjuli-5.gif"]
sprite2_images = ["anna-1.gif","anna-2.gif","anna-3.gif"]
sprite3_images = ["ballerina-a.gif","ballerina-b.gif","ballerina-c.gif","ballerina-d.gif"]
sprite4_images = ["breakdancer-1.gif","breakdancer-2.gif","breakdancer-3.gif","breakdancer-4.gif"]
sprite_images = [sprite1_images,sprite2_images,sprite3_images,sprite4_images]
try:
   [screen.addshape(image)  for images in sprite_images for image in images]    # 双重列表推导式
except:
    screen.bye()
    input("造型图片丢失或损坏! 无法注册造型到形状列表")   
    sys.exit()
    
 
# 4、音频初始化 

You must log in to read the rest of this article. Please log in or register as a user.