Commit 4b06e8c1 by BellCodeEditor

save project

parent 79857b8d
Showing with 14 additions and 4 deletions
import pygame import pygame
from pygame import locals from pygame import locals
click=0
pygame.init() # 初始化 screen=pygame.init() # 初始化
# 创建窗口 # 创建窗口
screen = pygame.display.set_mode((640, 480)) screen = pygame.display.set_mode((640, 480))
# 载入图片、资源 # 载入图片、资源
...@@ -12,7 +12,9 @@ last_img = pygame.image.load('last.png') # 上一曲按钮 ...@@ -12,7 +12,9 @@ last_img = pygame.image.load('last.png') # 上一曲按钮
next_img = pygame.image.load('next.png') # 下一曲按钮 next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 中间logo logo_img = pygame.image.load('logo.png') # 中间logo
pygame.mixer.music.load("歌曲4.ogg") pygame.mixer.music.load("歌曲4.ogg")
an_jian=stop_img
vol=0.5 vol=0.5
click = 0
pygame.mixer.music.set_volume(vol) pygame.mixer.music.set_volume(vol)
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
...@@ -30,12 +32,20 @@ while True: ...@@ -30,12 +32,20 @@ while True:
vol -=0.1 vol -=0.1
if vol<0: if vol<0:
vol==0 vol==0
pygame.mixer.music.set_volume(vol) if event.type== locals.MOUSEBUTTONDOWN:
click +=1
if click %2==0:
pygame.mixer.music.unpause()
an_jian=stop_img
else:
pygame.mixer.music.pause()
an_jian=play_img
pygame.mixer.music.set_volume(vol)
# 绘制画面 # 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景 screen.blit(bg_img, (0, 0)) # 填充背景
screen.blit(an_jian,(270,330))
screen.blit(logo_img, (170, 60)) # 中间logo图 screen.blit(logo_img, (170, 60)) # 中间logo图
screen.blit(last_img, (120, 350)) # 上一曲 screen.blit(last_img, (120, 350)) # 上一曲
screen.blit(next_img, (420, 350)) # 下一曲 screen.blit(next_img, (420, 350)) # 下一曲
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment