Introduction:

​​​​

Hello! Hello everyone ~ the beginning of the new week, Mumuzi to deliver welfare.

Go to supermarket to collect goods yesterday, see full 199 can turn round dish, have coupon, still have direct derate 50, give laundry liquid of what.

This activity has a good effect on attracting new people, promoting vitality, attracting customers and increasing growth. Many aunts are usually buying things. It doesn’t matter if they buy more this time

Do you often see online and offline store activities are to engage in lottery activities.

Every time I check in to the game or some articles are often everywhere to see this kind of lottery, rotary activities, change the same is the same way.

Then today xiaobian will take you to have a look and make a turntable lottery small procedures to play.

The body of the

First of all, prepare your own material to write good lottery options:

​​​​​​​​

(1) Environment installation.

Python3.6, PyCharm, PyGame, and some built-in modules.

pip  install  pygame
Copy the code

Such as the environment installation package, activation code and other missing directly find small make up with the source code sent to everyone free to share ha.

(2) Initialize pyGame class, set window title, refresh rate, etc.

pygame.init() screen = pygame.display.set_mode((600, Pygame.display. Set_caption: tick = pygame.time.clock () FPS = 10 Picture = pygame.transform.scale(pygame.image.load("./ ")), (600, 600)) bg=picture.convert() picture = pygame.transform.scale(pygame.image.load("./1.png"), (30, 230)) hand = picture.convert_alpha()Copy the code

(3) The user’s prize grade, judge the random rotary table is the prize.

def rewardFun():
    number = random.random()
    for k, v in rewardDict.items():
        if v[0] <= number < v[1]:
            return k
Copy the code

(4) Winning the prize.

def end(k): TextFont = pygame.font.Font("./font. TTF ", 50) print(" %s" % k, True, (110, 55, 155)) screen.fill((155, 155, 0)) screen.blit(textSurface, (30, 230))Copy the code

​​​​

conclusion

Is you are you are you, lucky wheel, open your own good luck! Production is not easy, remember one key three even oh!

If you need this article’s complete code + images, Python novice installation package, free activation code, and more Python materials.

Add source base penguin group: [private letter xiaobian 06] you can get free oh!!

​​