Commit d518abb1 by BellCodeEditor

save project

parent 67c35067
Showing with 11 additions and 0 deletions
import pygame
from pygame import locals
volume=0.5
pygame.init() # 初始化
# 创建窗口
screen = pygame.display.set_mode((640, 480))
......@@ -12,6 +13,8 @@ last_img = pygame.image.load('last.png') # 上一曲按钮
next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 中间logo
pygame.mixer.music.load('歌曲4.ogg')
c=0
play_button = stop_img
while True:
for event in pygame.event.get():
if event.type==locals.QUIT:
......@@ -27,6 +30,14 @@ while True:
if volume >= 1.0:
volume=1
pygame.mixer.music.set_volume(volume)
if event.type == locals.MOUSEBUTTONDOWN:
c += 1
if c%2==0:
play_button = stop_img
pygame.mixer.music.unpause()
else:
play_button = play_img
pygame.mixer.music.pause()
if pygame.mixer.music.get_busy()==False:
pygame.mixer.music.play()
......
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