- 帖子
- 8
- 精华
- 0
- 积分
- 50
- 阅读权限
- 20
- 注册时间
- 2013-10-17
- 最后登录
- 2015-8-6
|
- import pygame
- from sys import exit
- pygame.init()
- screen = pygame.display.set_mode((700, 170), 0, 32)
- pygame.display.set_caption("Hello, World!")
- bg1 = pygame.image.load('bg.jpg').convert()
- bg2 = pygame.image.load('bg2.jpg').convert()
- bg3 = pygame.image.load('bg3.jpg').convert()
- i=1
- bglist=[bg1,bg2,bg3]
- num=len(bglist)
- background=bglist[0]
- while True:
- for event in pygame.event.get():
- if event.type == pygame.QUIT:
- pygame.quit()
- exit()
- if event.type == pygame.MOUSEBUTTONDOWN:
- background=bglist[i]
- i=i+1
- if i>num-1 :
- i=0
- screen.blit(background,(0,0))
- pygame.display.update()
复制代码 |
|