公司年会抽奖程序-python

发一下自己写的公司抽奖程序。。

需求:公司年会要一个抽奖程序,转盘上的每一个人名是随机中奖的,中奖后的人不可以再次中奖,按住抽奖,就会一直在转,放开后,要再转一两圈才停。

呵,刚好自己在学python cocos2d, 就用这个刚学的东东,虽然只学了点皮毛..直接上源码

# coding:utf-8
# 
import sys
# import os
# sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../..'))
# 解决程序中要显示中文问题
reload(sys) 
sys.setdefaultencoding('utf8')
from pyglet import image, font
from pyglet.gl import *
from pyglet.window import key

from cocos.actions import *
from cocos.director import director
from cocos.layer import Layer 
from cocos.layer import ColorLayer 
from cocos.scene import Scene
from cocos.sprite import Sprite
from cocos.text import *
from cocos.menu import *
    
import random
from cocos.audio.effect import Effect
consts_window = {    
        "width": 680,
        "height": 700,
        "vsync": True,
        "resizable": True,       
        'audio_backend':'sdl' 
    }




def get_sprite_test( index ):
    d = tests[index]
    return Scene( d( index ) )

class SpriteLayer( Layer ):

    is_event_handler = True     #: enable pyglet's events

    def __init__( self, index=1 ):
        super(SpriteLayer, self ).__init__()
        self.index = index
        

        self.top_text = "广州德瀚信息信息科技有限公司-年会抽奖"

        self.image = pyglet.resource.image('r1.png',0.01)
        # self.image = image.AnimationFrame(image.load('r1.png'),0.1)
        self.image.anchor_x = self.image.width / 2
        self.image.anchor_y = self.image.height / 2

        self.rimage = pyglet.resource.image('r2.png',0.01)
        # self.rimage = image.AnimationFrame(image.load('r2.png'),0.1)
        self.rimage.anchor_x = self.image.width / 2
        self.rimage.anchor_y = self.image.height / 2

        self.bgimage = pyglet.resource.image('bg1.png')
        self.bgimage.anchor_x = self.image.width / 2
        self.bgimage.anchor_y = self.image.height / 2

        self.pressbgimage = pyglet.resource.image('bg2.png')
        self.pressbgimage.anchor_x = self.image.width / 2
        self.pressbgimage.anchor_y = self.image.height / 2



        self.prizeimage = pyglet.resource.
  • 2
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值