python某公司为员工发放奖品_python实现公司年会抽奖程序

本文实例为大家分享了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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值